зеркало из https://github.com/github/ruby.git
Do not escape + in Shellwords.escape
+ is not a character that requires escaping in Bourne sh. Fixes [Bug #14429]
This commit is contained in:
Родитель
2b6a9f3a1f
Коммит
43a16c98df
|
@ -147,7 +147,7 @@ module Shellwords
|
|||
# Treat multibyte characters as is. It is the caller's responsibility
|
||||
# to encode the string in the right encoding for the shell
|
||||
# environment.
|
||||
str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
|
||||
str.gsub!(/([^A-Za-z0-9_\-.,:+\/@\n])/, "\\\\\\1")
|
||||
|
||||
# A LF cannot be escaped with a backslash because a backslash + LF
|
||||
# combo is regarded as a line continuation and simply ignored.
|
||||
|
|
|
@ -68,6 +68,11 @@ class TestShellwords < Test::Unit::TestCase
|
|||
assert_equal "ps -p #{$$}", joined
|
||||
end
|
||||
|
||||
def test_shellescape
|
||||
assert_equal "''", shellescape('')
|
||||
assert_equal "\\^AZaz09_\\\\-.,:/@'\n'+\\'\\\"", shellescape("^AZaz09_\\-.,:\/@\n+'\"")
|
||||
end
|
||||
|
||||
def test_whitespace
|
||||
empty = ''
|
||||
space = " "
|
||||
|
|
Загрузка…
Ссылка в новой задаче