Bug 2281 - sh: behavior of backslash star inside parameter expansion
Summary: sh: behavior of backslash star inside parameter expansion
Status: RESOLVED DUPLICATE of bug 2695
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.13.x
Hardware: All All
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-23 11:51 UTC by Stanislav Brabec
Modified: 2010-10-30 02:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Brabec 2010-07-23 11:51:41 UTC
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.

Example:

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

Bash 2, busybox:
a-backslashstar-b-\backslashstar-c

Bash 3, Bash 4, zsh:
a*b-backslashstar-
Comment 1 Denys Vlasenko 2010-08-11 21:47:52 UTC
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.
Comment 2 Denys Vlasenko 2010-10-30 02:54:48 UTC

*** This bug has been marked as a duplicate of bug 2695 ***