| Summary: | Parameter expansion pattern removal bug in sh | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Robert Webb <webbhead> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 2.2.8-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
On Sun, 26 Sep 1999 07:26:48 MST, Robert Webb wrote:
> The last two echos output garbage in place of the trailing pattern
> which was removed.
The /bin/sh in both 3.2-STABLE and 4.0-CURRENT produce the expected
results:
$f=/tmp/user/wpage.html
${f%.*}=/tmp/user/wpage
${f%/*}=/tmp/user
${f%"/wpage.html"}=/tmp/user
"$f"=/tmp/user/wpage.html
"${f%.*}"=/tmp/user/wpage
"${f%/*}"=/tmp/user
"${f%"/wpage.html"}"=/tmp/user
Time to upgrade? :-)
Ciao,
Sheldon.
Sheldon Hearn, at 09:36 AM 9/27/99 +0200, you wrote: > >On Sun, 26 Sep 1999 07:26:48 MST, Robert Webb wrote: >> The last two echos output garbage in place of the trailing pattern >> which was removed. > >The /bin/sh in both 3.2-STABLE and 4.0-CURRENT produce the expected >results: That is good news. >Time to upgrade? :-) Yes! :) I already have 3.2 CDs to install at home. I submitted the bug report from an account at my ISP, though, and they will have a difficult time upgrading from 2.2.8 without breaking many customers' CGIs. Thanks for checking out this problem, Sheldon. -- Robert <robert@webbhead.com> State Changed From-To: open->closed Problem seems to be resolved some time ago |
The expansion of a Bourne shell parameter with a pattern to be removed produces garbage characters in place of the removed pattern when the pattern includes a slash, and the whole expansion string is quoted. Fix: unknown How-To-Repeat: Run this script: #!/bin/sh f=/tmp/user/wpage.html echo '$f='$f echo '${f%.*}='${f%.*} echo '${f%/*}='${f%/*} echo '${f%"/wpage.html"}='${f%"/wpage.html"} echo '' echo '"$f"='"$f" echo '"${f%.*}"='"${f%.*}" echo '"${f%/*}"='"${f%/*}" echo '"${f%"/wpage.html"}"='"${f%"/wpage.html"}" The last two echos output garbage in place of the trailing pattern which was removed.