Bug 13656 - variable substitution is broken starting with 1.32.0 when variable is unset
Summary: variable substitution is broken starting with 1.32.0 when variable is unset
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.32.x
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-23 05:36 UTC by Risto
Modified: 2021-03-30 13:18 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 Risto 2021-03-23 05:36:44 UTC
Incorrect Behaviour in 1.32.0
# unset FOO
# echo ${FOO//,/}
/
# echo ${FOO/,/}
/
# echo ${FOO//}

# FOO=
# echo ${FOO//}

# echo ${FOO/,/}

# echo ${FOO//,/}

Correct Behaviour in 1.31.1
# unset FOO
# echo ${FOO//,/}

# echo ${FOO/,/}

# echo ${FOO//}

# FOO=
# echo ${FOO//}

# echo ${FOO/,/}

# echo ${FOO//,/}
Comment 1 Risto 2021-03-23 07:09:40 UTC
tested with

docker run -it busybox:1.31.1 sh -c 'echo ${FOO//,/}'

docker run -it busybox:1.32.0 sh -c 'echo ${FOO//,/}'
/
Comment 2 Denys Vlasenko 2021-03-30 13:18:24 UTC
Fixed in 1.33.0

commit 883cdb79a440d0425766f67aaef0cabde0a5060e
Date:   Sat Jan 9 08:27:37 2021 +0100

    ash: fix ${unset_var/pattern/repl}