Hi,

I'd like to report what seems to be a bug in the busybox's test command. I use the official alpine:3 docker container.

The test -r does not return true even when the file is indeed readable (testing by head command). Yes, the file has an unusual set of permissions, but that does not restrict it from reading. Here's the output of the interactive container shell session:

dd72078df6d2:/task/output/files$ ls -lad . .. cnb_rate_eur_czk.csv
drwxrwx---    2 setup    project        4096 Feb 11 18:33 .
drwxr-x---    5 setup    project        4096 Feb 11 18:33 ..
-rw-r--r--    1 task     project       20512 Feb 11 18:33 cnb_rate_eur_czk.csv

dd72078df6d2:/task/output/files$ id
uid=2001(setup) gid=2000(project) groups=2000(project)

dd72078df6d2:/task/output/files$ head -1 cnb_rate_eur_czk.csv
date,rate

dd72078df6d2:/task/output/files$ [ -r cnb_rate_eur_czk.csv ] && echo READABLE
dd72078df6d2:/task/output/files$ [[ -r cnb_rate_eur_czk.csv ]] && echo READABLE

dd72078df6d2:/task/output/files$ which [
/usr/bin/[
dd72078df6d2:/task/output/files$ which [[
/usr/bin/[[

dd72078df6d2:/task/output/files$ ls -la /usr/bin/[*
lrwxrwxrwx    1 root     root            12 Jan  9 12:46 /usr/bin/[ -> /bin/busybox lrwxrwxrwx    1 root     root            12 Jan  9 12:46 /usr/bin/[[ -> /bin/busybox

dd72078df6d2:/task/output/files$ /bin/busybox
BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
...

Here's how the container was built:

Sending build context to Docker daemon   25.6kB
Step 1/6 : FROM alpine:3
3: Pulling from library/alpine
8921db27df28: Pulling fs layer
8921db27df28: Download complete
8921db27df28: Pull complete
Digest: sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a
Status: Downloaded newer image for alpine:3
 ---> 042a816809aa
Step 2/6 : LABEL maintainer="d...@project.com"
 ---> Running in cbe6d0033ff3
Removing intermediate container cbe6d0033ff3
 ---> cfdded5747d9
Step 3/6 : RUN apk add --no-cache   curl    bash tar     tzdata  && addgroup --gid 2000 project && adduser --uid 2001 --home / --no-create-home --ingroup project --gecos "project Setup-Teardown" --disabled-password setup  && adduser --uid 2002 --home /home/task --ingroup project --gecos "project Task" --disabled-password task
 ---> Running in 4b16dff318b9
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
(1/12) Installing ncurses-terminfo-base (6.3_p20221119-r0)
(2/12) Installing ncurses-libs (6.3_p20221119-r0)
(3/12) Installing readline (8.2.0-r0)
(4/12) Installing bash (5.2.15-r0)
Executing bash-5.2.15-r0.post-install
(5/12) Installing ca-certificates (20220614-r4)
(6/12) Installing brotli-libs (1.0.9-r9)
(7/12) Installing nghttp2-libs (1.51.0-r0)
(8/12) Installing libcurl (7.87.0-r1)
(9/12) Installing curl (7.87.0-r1)
(10/12) Installing libacl (2.3.1-r1)
(11/12) Installing tar (1.34-r1)
(12/12) Installing tzdata (2022f-r1)
Executing busybox-1.35.0-r29.trigger
...


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to