proot-me / proot

chroot, mount --bind, and binfmt_misc without privilege/setup for Linux
https://proot-me.github.io
GNU General Public License v2.0
1.96k stars 369 forks source link

partial: add faccessat2 syscall #338

Closed deliciouslytyped closed 1 year ago

deliciouslytyped commented 1 year ago

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)

Tuupertunut commented 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:

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 ?

oxr463 commented 1 year ago

Sure, I can release a new patch version soon.

oxr463 commented 1 year ago

New release here: https://github.com/proot-me/proot/releases/tag/v5.4.0