Actions
Bug #10055
closedShellwords.shellsplit() does not match POSIX sh behavior for backslashes within double-quoted strings
Bug #10055: Shellwords.shellsplit() does not match POSIX sh behavior for backslashes within double-quoted strings
Description
In POSIX sh, the following commands are identical:
printf '%s\n' hello world printf "%s\n" hello world However, Shellwords.shellsplit() parses them differently:
head :001 > require 'shellwords' => true head :002 > Shellwords.shellsplit(%q|printf "%s\\n"|) => ["printf", "%sn"] head :003 > Shellwords.shellsplit(%q|printf '%s\\n'|) => ["printf", "%s\\n"] The documentation for the shellwords module claims that its parser is compatible with Bourne; however, it does not match either this 1970s-era shell language or modern POSIX sh (which is the actual specification used for /bin/sh on modern systems, and incompatible in some respects with original Bourne), both of which preserve backslashes in this context.
Actions