From 0924e52c246878380ac6bb73f3d6acf44910a9d4 Mon Sep 17 00:00:00 2001 From: kazu Date: Sun, 26 Dec 2010 23:30:33 +0000 Subject: [PATCH] * lib/optparse.rb (OptionParser#compsys): escape brackets too. [ruby-dev:42754] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/optparse.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dbcfc4f1ef4f44..eced2dc54ebafc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Dec 27 07:32:07 2010 Kazuhiro NISHIYAMA + + * lib/optparse.rb (OptionParser#compsys): escape brackets too. + [ruby-dev:42754] + Mon Dec 27 01:30:08 2010 Tanaka Akira * ext/socket/mkconstants.rb: add IF_NAMESIZE. diff --git a/lib/optparse.rb b/lib/optparse.rb index c91334d92eb243..70fda8120787c9 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -763,7 +763,7 @@ def compsys(to, name = File.basename($0)) # :nodoc: to << "#compdef #{name}\n" to << COMPSYS_HEADER visit(:compsys, {}, {}) {|o, d| - to << %Q[ "#{o}[#{d.gsub(/\"/, '\"')}]" \\\n] + to << %Q[ "#{o}[#{d.gsub(/[\"\[\]]/, '\\\\\&')}]" \\\n] } to << " '*:file:_files' && return 0\n" end