Issue #14429 has been reported by woodruffw (William Woodruff).

----------------------------------------
Bug #14429: Overzealous escaping of + in Shellwords
https://bugs.ruby-lang.org/issues/14429

* Author: woodruffw (William Woodruff)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux-gnu]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
The `Shellwords` module is currently a little too conservative: `+` isn't a token in Bourne sh[1], but `Shellwords` escapes it anyways.

Actual:

~~~ ruby
>> Shellwords.escape 'foo+bar' #=> "foo\\+bar"
~~~

Expected:

~~~ ruby
>> Shellwords.escape 'foo+bar' #=> "foo+bar"
~~~


I'm reporting this on ruby 2.4.3, but it looks like ruby-trunk is also affected[2].

[1]: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
[2]: https://github.com/ruby/ruby/blob/trunk/lib/shellwords.rb#L150




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>