I found that `toybox test -w` returned true for a file with 0440 mode bits, and was able to find failures for other cases (below).
I think the root cause and fix is to use octal 0111 instead of hexadecimal 0x111 on this line: https://github.com/landley/toybox/blob/master/toys/posix/test.c#L74 Thank you, Luke generic_x86_arm:/ # toybox --version toybox 0.8.3-android generic_x86_arm:/ # chmod 0440 /data/foo ; ls -l /data/foo ; stat -c "%a %A %f" /data/foo -r--r----- 1 root root 0 2020-11-24 16:45 /data/foo 440 -r--r----- 8120 generic_x86_arm:/ # toybox test -w /data/foo ; echo $? 0 generic_x86_arm:/ # chmod 0444 /data/foo ; ls -l /data/foo ; stat -c "%a %A %f" /data/foo -r--r--r-- 1 root root 0 2020-11-24 16:45 /data/foo 444 -r--r--r-- 8124 generic_x86_arm:/ # toybox test -x /data/foo ; echo $? 0 generic_x86_arm:/ # toybox test -w /data/foo ; echo $? 0
_______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
