Pádraig Brady <[email protected]> writes:

> The first patch fixes chmod to now correctly diagnose
> its failure to work with any files on Linux <= 6.5
> when /proc is not available (like e.g. in a chroot).
> Otherwise it would silently do nothing, ignoring all
> the ENOTSUPs it was getting.
>
> I'm a bit surprised we didn't get any reports for that,
> but I suppose Linux 6.6 was released in 2023 and
> coreutils 9.5 was released in 2024, so there wouldn't
> have been huge overlap of this issue.
>
> The second patch adds the racy fallback (without AT_SYMLINK_NOFOLLOW),
> to allow chmod to work on older systems without /proc.
> However I'm 60:40 against applying that one because:
>  1. The problematic kernels are over 3 years old now
>     and we did get no reports after all.
>  2. It should be easy enough to mount /proc to avoid the issue
>  3. The fallback is TOCTOU racy.

Speaking generally, I think it is nice to support old systems when
possible. Even if it involves an implementation with races. In many
cases, Gnulib fallbacks have races because the operating system does not
provide adequate functionality to avoid them.

I see that the current oldest LTS kernel is 5.10.274, which I assume
would be affected by this issue [1]. Granted, I assume those releases
are mostly used by distributors, e.g., Red Hat, which will provide
various other patches and a coreutils version from around the time of
5.10's initial release. Going out of their way to build the latest
coreutils release would be strange.

The first patch looks good for certain, though. If someone actually ran
into it, I could see it causing a lot of confusion.

Collin

[1] https://www.kernel.org/

Reply via email to