When IFS is null, unquoted $* within an unquoted substitution (e.g.
${1+$*} or ${unset_var-$*}) joins the PPs together into one field, as if
either "$*" or the whole substitution were quoted.

POSIX says the unquoted substitution is supposed to generate one field
for each positional parameter, with further field splitting inactive due
to empty IFS.

Unquoted $* outside of a substitution does this correctly; the bug only
occurs within one.

Test:

bash -c 'IFS=; set "abc" "def ghi" "jkl";
        set ${1+$*}; printf "[%s]\\n" "$#" "$@"'

Actual output:
[1]
[abcdef ghijkl]

Expected output (as produced by every other shell):
[3]
[abc]
[def ghi]
[jkl]

Bug confirmed on bash 3.2.57, 4.3.30, 4.4.12.

Bug confirmed *not* present on bash 2.05b.

Thanks,

- M.

Reply via email to