aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-10-02 07:24:38 -0500
committerRob Landley <rob@landley.net>2014-10-02 07:24:38 -0500
commit2ccab0260f6812f78cc0bafdf2bb2a92942ee6f3 (patch)
treef788c94bd29a139f139abf74dfbd93700c01205e /toys/lsb
parent76678fa5730dfced54c95696e77fdbc6c9c9e839 (diff)
downloadtoybox-0.5.0.tar.gz
Workaround for musl's faccessat bug (the rm -r "error: is a directory" thing).0.5.0
The Linux man page says I can use AT_SYMLINK_NOFOLLOW. It works in glibc, uclibc, and klibc, but musl returns -EINVAL any time you pass in that flag and the maintainer says that's not a bug and insists the man page and those other libraries all change to match musl's behavior. Toybox uses it to avoid scheduling unnecessary metadata writes for things we're about to delete (have to chmod unreadable directories so we can descend into them to delete their contents, the chmod happens before we descend so the disk I/O has plenty of time to be scheduled) because the extra writes wear out SSD faster. It's just an optimization and I don't really care if it works _well_ (the fchmodat call _also_ takes AT_SYMLINK_NOFOLLOW so that's covered), but musl's behavior uniquely makes the check always error and thus breaks normal "rm -r". Yes this workaround is checking #ifdef __MUSL__ which the library does not supply (because its code is perfect and will thus never need to be worked around). You can CFLAGS=-D__MUSL__ if you don't echo "#define __MUSL__" >> include/features.h when installing the library.
Diffstat (limited to 'toys/lsb')
0 files changed, 0 insertions, 0 deletions