Starting with alpine 3.14 the file test operator [ -x <FILE> ] seems to return false for executable files:
$ docker run -it alpine:3.14 ~/repos/cailleach
/ # apk update && apk add bash
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
v3.14.0-35-g61662e7eee [https://dl-cdn.alpinelinux.org/alpine/v3.14/main]
v3.14.0-42-g4ddf944b0f [https://dl-cdn.alpinelinux.org/alpine/v3.14/community]
OK: 14921 distinct packages available
(1/4) Installing ncurses-terminfo-base (6.2_p20210612-r0)
(2/4) Installing ncurses-libs (6.2_p20210612-r0)
(3/4) Installing readline (8.1.0-r0)
(4/4) Installing bash (5.1.4-r0)
Executing bash-5.1.4-r0.post-install
Executing busybox-1.33.1-r2.trigger
OK: 8 MiB in 18 packages
/ # ls -l /usr/bin/wget
lrwxrwxrwx 1 root root 12 Jun 15 14:34 /usr/bin/wget -> /bin/busybox
/ # bash -c 'if [ -x "/usr/bin/wget" ]; then echo "expected."; else echo "unexpected!!!"; fi'
unexpected!!!
Compare this with the same command to alpine 3.13
$ docker run -it alpine:3.13 ~/repos/cailleach
/ # apk update && apk add bash
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
v3.13.5-213-g41f154cbb2 [https://dl-cdn.alpinelinux.org/alpine/v3.13/main]
v3.13.5-205-gb75f01a32f [https://dl-cdn.alpinelinux.org/alpine/v3.13/community]
OK: 13890 distinct packages available
(1/4) Installing ncurses-terminfo-base (6.2_p20210109-r0)
(2/4) Installing ncurses-libs (6.2_p20210109-r0)
(3/4) Installing readline (8.1.0-r0)
(4/4) Installing bash (5.1.0-r0)
Executing bash-5.1.0-r0.post-install
Executing busybox-1.32.1-r6.trigger
OK: 8 MiB in 18 packages
/ # ls -l /usr/bin/wget
lrwxrwxrwx 1 root root 12 Apr 14 10:25 /usr/bin/wget -> /bin/busybox
/ # bash -c 'if [ -x "/usr/bin/wget" ]; then echo "expected."; else echo "unexpected!!!"; fi'
expected.
This could also be a bug in busybox, which provides the [ command for testing.
Starting with alpine 3.14 the file test operator
[ -x <FILE> ]seems to returnfalsefor executable files:Compare this with the same command to alpine 3.13
This could also be a bug in busybox, which provides the
[command for testing.