Closed deliciouslytyped closed 1 year ago
This fix turns out to be quite important. All recent versions of bash use faccessat2
for its [ -w ]
, [ -x ]
and [ -r ]
tests. These test statements are in turn used in many bash scripts. Usually they are in form [ -x someprogram ] && run someprogram
Notable examples are:
.bashrc
in Ubuntu. It shows an error every time I login to a Ubuntu Proot. Reproduction:
user@machine:~/containers$ proot -r ubuntu-rootfs -b /etc/resolv.conf -b /proc -b /sys -b /dev -0 -w /root /bin/su --login
-bash: /usr/lib/command-not-found: No such file or directory
root@machine:~#
ca-certificates
. In a Ubuntu Proot, apt fails to install any package that has ca-certificates
as its dependency and that's quite a lot of packages.dmsetup
. Quite a lot of packages depend on this too.After applying the fix in this PR, Ubuntu 22.04 now runs perfectly. It might be worth releasing this PR as a hotfix release, what do you think @oxr463 ?
Sure, I can release a new patch version soon.
New release here: https://github.com/proot-me/proot/releases/tag/v5.4.0
This is a minimal amount of work I did to get it to work (I think.) on my system to the extent of having bash -c '[ -w /somepath ]; echo $?' work correctly.
Currently faccess2 is used (proven by strace outside of proot) on my system, which isn't implemented, and isn't translate()-ed, and so is broken.
I don't know if any behavioral modifications need to be made to handle the flags added to faccessat2 as opposed to faccessat not having them and being handled in glibc. (see the man page)