[Bug 2695] pattern substitution fails if pattern contains slashes

bugzilla at busybox.net bugzilla at busybox.net
Sat Oct 30 02:55:02 UTC 2010


--- Comment #2 from Denys Vlasenko <vda.linux at googlemail.com>  ---
>From bug 2281

There was a bug in expansion of star inside parameter in expressions like
${FOO//\\*/-star-}. In bash 2 and lower two backslashes were eaten for escaping
of star. Since bash 3 the bug is fixed. The fix introduced a small change of
the behavior (one backslash escapes second backslash). Also zsh already
migrated to the fixed behavior.

Busybox exactly follows (at least in version 1.13) the bash 2 behavior
considered as broken. It would be nice to migrate it to the fixed behavior.


FOO="a*b\\*c" ; echo ${FOO//\\*/-backslashstar-}

Bash 2, busybox:

Bash 3, Bash 4, zsh:


Fixed in git. While at it, found and quashed two more bugs.
However, quoted version:

FOO="a*b\\*c"; echo "${FOO//\\*/-backslashstar-}"

is still broken, and is _hard_ to fix.

There is now a testcase for it:
Go to busybox/shell/ash_test in buld tree and run "run-all".
Examine ash-vars-var_bash4.tests.fail to see quoted expansion error.

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list