Subject: bug#75405: gzip --synchronous doesn't work with musl

From: Paul Eggert <[email-masked]>
Date: Wed, 8 Jan 2025 00:37:12 -0800

On 2025-01-07 10:22, Lasse Collin wrote:

> However, one thing that isn't an issue in musl is fchmod which is
> currently documented in Gnulib's doc/posix-headers/fcntl.texi. fchmod
> and a few others were fixed in 2013 by using /proc/self/fd.[1]

Is that a full fix, though? /proc might not be mounted.

> Gnulib's docs could be updated to remove fchmod and add fsync and
> fdatasync. Even if proc-based emulation was added, I don't see how it
> could be great if it needs to do open+fsync+close where the open with
> O_RDONLY might fail. But I might be missing something (again).
> 
> [1] https://git.musl-libc.org/cgit/musl/commit/?id=9ca1f62b0c0d3e50480eb654ac941ff943ce0558
> 
>> Would the following Gnulib patch work around the musl bug?
> 
> It does, thanks!

OK, I installed it.

> Should it check for __linux__ too to be sure that the workaround won't
> accidentally apply on some other kernel or libc that has O_PATH?

Anything else with O_SEARCH == O_PATH is likely to have similar 
problems. If not, we can cross that bridge when we come to it.

> It could be useful to add a test for gzip --synchronous.

Feel free....