Bug 10901 - Shell parameter expansion not working for /
Summary: Shell parameter expansion not working for /
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.27.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-29 11:14 UTC by camabeh
Modified: 2018-04-08 14:57 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 camabeh 2018-03-29 11:14:21 UTC
Hello, I am trying to escape varaible which will be used in `sed` command but unfortunately it looks like there is some bug in handling parameter expansion in busybox shell.

Expected:
> Bash in Ubuntu:
```sh
$ var="/Users/Documents/name/file"; echo "${var//\//\\/}"
\/Users\/Documents\/name\/file
```

Actual:
> Shell in Alpine:
```sh
$ var="/Users/Documents/name/file"; echo "${var//\//\\/}"
/Users/Documents/name/file
```

It's wierd because parameter expansion with replacement is working for other characters.

> Bash in Ubuntu:
```sh
$ var="/Users/Documents/name/file"; echo "${var//e/E}"
/UsErs/DocumEnts/namE/filE
```
> Shell in Alpine:
```sh
$ var="/Users/Documents/name/file"; echo "${var//e/E}"
/UsErs/DocumEnts/namE/filE
```

Env:
BusyBox v1.27.2 (2017-11-28 16:17:30 GMT) multi-call binary.
Alpine 3.7

Ref:
https://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion
Comment 1 Denys Vlasenko 2018-04-08 14:57:44 UTC
Fixed in git, will be in 1.29.x