Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash under alpine:edge failed in testing file writable #156

Open
ouyangde opened this issue Mar 12, 2021 · 7 comments
Open

bash under alpine:edge failed in testing file writable #156

ouyangde opened this issue Mar 12, 2021 · 7 comments

Comments

@ouyangde
Copy link

Steps to reproduce:

   root@vm ~# docker run --rm -it alpine:edge sh
   / # apk --update add bash
   fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
   (1/4) Installing ncurses-terminfo-base (6.2_p20210306-r0)
   (2/4) Installing ncurses-libs (6.2_p20210306-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.0-r2.trigger
   OK: 8 MiB in 18 packages
   / # touch test
   / # bash -c '[ -w test ] && echo 1'
   / # sh -c '[ -w test ] && echo 1'
   1
   / # exit

Version to reproduce: (Result from docker inspect alpine:edge)

    "Id": "sha256:34dac78053209f08ed66b41b4730ac08603e06a1888072d7145efb68a3b2aa8a",
    "RepoTags": [
        "alpine:edge"
    ],
    "RepoDigests": [
        "alpine@sha256:78b6d0a9e7a5b3d2aa1c10932f08272d360a9b35e80b3cc5fb04b30e04fecf4b"
    ],
    "Parent": "",
    "Comment": "",
    "Created": "2021-02-12T20:19:59.864166354Z",
@fabiorauber
Copy link

Found an issue to check if file is readable in library/alpine:3.14: the file has read permission for everyone (checked) but the test returns an error code:

bash-5.1# [[ -r /etc/dehydrated/domains.txt ]]
bash-5.1# echo $?
1
bash-5.1# ls -alh /etc/dehydrated/
total 32K
drwxr-xr-x    1 root     root        4.0K Jun 29 18:30 .
drwxr-xr-x    1 root     root        4.0K Jun 29 18:20 ..
-rw-r--r--    1 root     root          96 Jun 29 18:30 domains.txt

@fabiorauber
Copy link

fabiorauber commented Jun 29, 2021

Reverting to library/alpine:3.13 fixed the issue, for me.

bash-5.1# [[ -r domains.txt ]]
bash-5.1# echo $?
0

@macmeck
Copy link

macmeck commented Aug 30, 2021

very annoying bug, I stumbled upon this one myself. Still present in the current version of alpine:3.14

Any suggestions on how to tackle or any WIP on this? going back to 3.13 might not be the smartest solution here.

@mk-dhia
Copy link

mk-dhia commented Sep 3, 2021

This is related to faccessat2 syscall has been enabled in musl in alpine starting 3.14. Due to a bug in runc it fails if your kernel do not support faccessat2.
Short answer update runc to >= 1.0.0-rc93 or update kernel to 5.8 (upgrading kernel should work but i haven't tested it)
Detail in release note
https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2
Bug in runc (fixed in 1.0.0-rc93 )
opencontainers/runc#2151

@gendergap
Copy link

This also seems to affect the executable test in Alpine 3.14:

$> docker run -it alpine:3.14 /bin/sh
/ # apk update && apk add bash 
...
/ # bash
bash-5.1# if [ ! -x /bin/bash ]; then echo "I should not get printed!"; fi
I should not get printed!
bash-5.1#

Not sure whether this is worth a new issue here?

@lff0305
Copy link

lff0305 commented Dec 20, 2021

Same issue on alpine:3.15.0 and alpine:edge.

Directory test also failed ( test -x /tmp then echo $? , got 1 )

@SaberStrat
Copy link

And issue exists in alpine images 3.17.2, 3.17.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants