Re: [dev] [sbase] chmod -R and symbolic links

From: Laslo Hunhold <>
Date: Mon, 23 Dec 2019 16:47:59 +0100

On Sat, 21 Dec 2019 19:05:45 -0800
Michael Forney <> 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

With best regards


Received on Mon Dec 23 2019 - 16:47:59 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 23 2019 - 18:00:06 CET