wolfi-dev / os

Main package repository for production Wolfi images
Other
808 stars 234 forks source link

dash-binsh doesn't restore busybox sh after removal #17605

Open xnox opened 5 months ago

xnox commented 5 months ago

dash-binsh doesn't restore busybox sh after removal

Install busybox, /bin/sh points at busybox.

Install dash-binsh, /bin/sh points at dash.

Remove dash-binsh, /bin/sh is now gone.

Maybe we can add a post-deinstall scriplet to check if busybox exists and if so, run install on it again.

smoser commented 5 months ago

apk-package(5) says:

triggers List of directory globs. APK will execute the trigger script with list of matched directories when any action (package installation, removal) has modified content of that directory. When package is being fixed or installed it will get list of all matching directories.

so the script we have in busybox.yaml should get called.

I tested that the script does work even in the absence of /bin/sh:

bash-5.2# cat xx
#!/bin/busybox sh
/bin/busybox --install -s
bash-5.2# ls -l /bin/sh
lrwxrwxrwx    1 root     root            12 Apr 24 16:55 /bin/sh -> /bin/busybox
bash-5.2# cat xx
#!/bin/busybox sh
/bin/busybox --install -s
bash-5.2# chmod 755 xx
bash-5.2# rm /bin/sh
bash-5.2# ./xx
bash-5.2# ls -l /bin/sh
lrwxrwxrwx    1 root     root            12 Apr 24 16:56 /bin/sh -> /bin/busybox