diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/optparse.rb | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Mon Dec 27 07:32:07 2010 Kazuhiro NISHIYAMA <[email protected]> + + * lib/optparse.rb (OptionParser#compsys): escape brackets too. + [ruby-dev:42754] + Mon Dec 27 01:30:08 2010 Tanaka Akira <[email protected]> * ext/socket/mkconstants.rb: add IF_NAMESIZE. diff --git a/lib/optparse.rb b/lib/optparse.rb index c91334d92e..70fda81207 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -763,7 +763,7 @@ XXX 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 |