Bug 15614 - ash: case weird behavior with ] character
Summary: ash: case weird behavior with ] character
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-31 13:59 UTC by t_i_a_w_l
Modified: 2023-05-31 13:59 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 t_i_a_w_l 2023-05-31 13:59:57 UTC
Hello,

I installed busybox 1_36_1 from the source code on an alpine 3.18.0 container:
$ git clone 'https://git.busybox.net/busybox' /opt/busybox > /dev/null 2>&1 && echo OK
OK
$ git -C /opt/busybox checkout 1_36_1 > /dev/null 2>&1 && echo OK
OK
$ make -C /opt/busybox defconfig > /dev/null 2>&1 && echo OK
OK
$ make -C /opt/busybox busybox > /dev/null 2>&1 && echo OK
OK
$ make -C /opt/busybox CONFIG_PREFIX=/usr install > /dev/null 2>&1 && echo OK
OK
$ /usr/bin/busybox | head -n 1
BusyBox v1.36.1 (2023-05-31 13:28:40 UTC) multi-call binary.
$ /usr/bin/busybox ash -c 'char="a"; case "$char" in ["$char"]) echo TRUE ;; *) echo FALSE ;; esac'
TRUE
$ /usr/bin/busybox ash -c 'char="]"; case "$char" in ["$char"]) echo TRUE ;; *) echo FALSE ;; esac'
FALSE

char variable is double quoted so the value should be interpreted as a string, not a special character. Is this a normal behavior ?

Thank you.