Bug 15614

Summary: ash: case weird behavior with ] character
Product: Busybox Reporter: t_i_a_w_l
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

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.