On Sat, 21 Dec 2019 19:05:45 -0800 Michael Forney <mfor...@mforney.org> wrote:
Dear Michael, > I can think of two possibilities here: > > 1. Remove the -H, -L, and -P options from chmod, always set r.follow = > 'H', and call chmod(3) conditional on !S_ISLINK(st->st_mode). > 2. Keep the -H, -L, and -P options, but use fchmodat(3) instead of > chmod(3) with AT_SYMLINK_NOFOLLOW depending on r->follow and r->depth. > If fchmodat fails with EOPNOTSUPP, ignore that and continue. > > Does anyone have a strong preference for 2? I'm leaning towards 1 > since it doesn't seem like those options are used commonly. I have a strong preference for 2 tbh, but it's your discretion as the maintainer. Only because the other tools "suck" doesn't mean we should lower our standards. Especially with the H, L and P options we found many bugs in GNU coreutils, and keeping them in is essential if we want to claim that we are more or less POSIX compliant. The use of *at()-functions is generally encouraged, as you also showed in your recurse-refactoring. So yeah, tl;dr: I'd keep the flags and then use fchmodat() instead of chmod(). With best regards Laslo
pgp1M410F_yfu.pgp
Description: OpenPGP digital signature