On 2026-05-27 21:18, Collin Funk wrote:
     /usr/include/bits/signum-generic.h:60:9: warning: 'SIGPIPE' redefined
Thanks for reporting this. I just now rediscovered your bug report; sorry about 
the delay. Because redefining a macro is a constraint violation and leads to 
undefined behavior, I installed the attached, which mirrors your first attached 
patch but with a commit explaining where the glitch came from.

We're close to a release so I'll hold off on the other patches in the bug 
report, as they merely pacify warnings about valid C code that every compiler 
should accept, if only grudgingly. I'll leave the bug report open.

One other thing I noticed: tailor.h's FALLTHROUGH macro should be replaced by 
"#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH" or better yet we should delete 
that definition and include attribute.h as we already have attribute.h anyway. But that 
is also merely a pacification (this time, for non-GCC or ancient GCC) not a bug fix and 
so it can wait too.
From 6909da4d3f3c567f802404eb99358b78c80410ef Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 5 Sep 2026 09:16:18 -0700
Subject: [PATCH] gzip: fix undefined behavior with SIGPIPE

This problem arose due to a combination of commit
bb78ea465787191e8987d4b8a6594f9f23a18930 dated 2013-06-11,
which defined SIGPIPE to 0 if not already defined, with commit
ede0a8888a4d3d0750e1651e01f198e2faab5d59 dated 2026-05-25,
which included tailor.h before all system .h files.
Problem and fix reported by Collin Funk (bug#81139).
* gzip.c (handled_sig): ifdef, not if, for SIGPIPE.
* tailor.h (SIGPIPE): Do not #define to 0, because when we later
include <signal.h> its #define yields undefined behavior.
---
 gzip.c   | 2 +-
 tailor.h | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/gzip.c b/gzip.c
index c2eb77e..be823c1 100644
--- a/gzip.c
+++ b/gzip.c
@@ -251,7 +251,7 @@ static int handled_sig[] =
 #ifdef SIGHUP
     , SIGHUP
 #endif
-#if SIGPIPE
+#ifdef SIGPIPE
     , SIGPIPE
 #endif
 #ifdef SIGTERM
diff --git a/tailor.h b/tailor.h
index b943292..8412dde 100644
--- a/tailor.h
+++ b/tailor.h
@@ -152,11 +152,6 @@
 #  define UNALIGNED_OK
 #endif
 
-#ifndef SIGPIPE
-# define SIGPIPE 0
-#endif
-
-
         /* Common defaults */
 
 #ifndef OS_CODE
-- 
2.53.0

Reply via email to