bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Paul Eggert
Subject: bug#75405: gzip --synchronous doesn't work with musl
Date: Mon, 6 Jan 2025 10:02:41 -0800
User-agent: Mozilla Thunderbird

On 2025-01-06 05:29, Lasse Collin wrote:

In musl, O_SEARCH maps to Linux-specific O_PATH

That is a bug in musl. musl should not define O_SEARCH to O_PATH on Linux, because O_PATH is not a valid implementation of O_SEARCH. Or if musl wants to do some sort of approximate-but-invalid implementation to POSIX, a better approximation is "#define O_SEARCH O_RDONLY", which is what Gnulib does in lib/fcntl.in.h. The approximation "#define O_SEARCH O_PATH" is more likely to break real-world applications than the approximation "#define O_SEARCH O_RDONLY" is.


As far as I understand this, O_SEARCH in POSIX is only meant for openat
and such APIs.

No, O_SEARCH is well defined in POSIX to work in plain 'open'. See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/open.html>.


Would the following Gnulib patch work around the musl bug?

diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 5f06c4fe10..44d02fb9fd 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -369,6 +369,11 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 # define O_RSYNC 0
 #endif

+/* musl on GNU/Linux mistakenly has "#define O_SEARCH O_PATH".  */
+#if defined O_SEARCH && defined O_PATH && O_SEARCH == O_PATH
+# undef O_SEARCH
+#endif
+
 #ifndef O_SEARCH
# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
 #endif






reply via email to

[Prev in Thread] Current Thread [Next in Thread]