summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-12 18:42:03 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-12 18:42:03 +0000
commit8c72fc9bf09071300b6283411b4481456aac7e34 ()
tree7b107fcfad5476a304edf94b6f9a119cee1d8c7d
parent44d20d61c7babae9fd2ac3c6578208efa631d5a3 (diff)
* lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
consecutive backslashes in double quotes are all removed except the one at the tail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/shellwords.rb2
-rw-r--r--test/test_shellwords.rb9
3 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,9 @@
Fri Jan 13 03:28:00 2012 Luis Lavena <[email protected]>
* ext/socket/extconf.rb (if ipv6): only define _WIN32_WINNT if was not
@@ -41,7 +41,7 @@ module Shellwords
line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/m) do
|word, sq, dq, esc, garbage, sep|
raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage
- field << (word || sq || (dq || esc).gsub(/\\(?=.)/, ''))
if sep
words << field
field = ''
@@ -38,6 +38,15 @@ class TestShellwords < Test::Unit::TestCase
end
end
def test_multibyte_characters
# This is not a spec. It describes the current behavior which may
# be changed in future. There would be no multibyte character