Subject: Re: bug#77724: [PATCH] maint: include errno.h

From: Andreas Stieger <[email-masked]>
Date: Fri, 11 Apr 2025 10:09:31 +0200

On 2025-04-11 09:14, Paul Eggert wrote:
> Why is this needed? What happens if you omit "#include <errno.h>".

Sure no problem. Without this patch, on (our) s390x build (only):

[  443s] gcc -DHAVE_CONFIG_H -I. -I./lib  -I./lib    -O2 -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong
-funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection
-Werror=return-type -flto=auto -g -fomit-frame-pointer
-Dalignas=_Alignas -W -Wall -Wno-unused-parameter -Wstrict-prototypes
-Wpointer-arith -fPIE -DDFLTCC_LEVEL_MASK=0x7e -fprofile-generate -c -o
dfltcc.o dfltcc.c
[  443s] dfltcc.c: In function 'dfltcc_inflate':
[  443s] dfltcc.c:441:15: error: 'errno' undeclared (first use in this
function)
[  443s]   441 |               errno = 0;
[  443s]       |               ^~~~~
[  443s] dfltcc.c:28:1: note: 'errno' is defined in header '<errno.h>';
this is probably fixable by adding '#include <errno.h>'
[  443s]    27 | #include "gzip.h"
[  443s]   +++ |+#include <errno.h>
[  443s]    28 |
[  443s] dfltcc.c:441:15: note: each undeclared identifier is reported
only once for each function it appears in
[  443s]   441 |               errno = 0;
[  443s]       |               ^~~~~
[  443s] make[2]: *** [Makefile:2050: dfltcc.o] Error 1

I did not dive into the why because the fix seems obvious. Looks like
this fixes: 23ddd95
<https://github.com/andreasstieger/gzip/commit/23ddd95f3e152423fe0dfc96ff31d4130a65e8cf>
"gzip: better fix for s390 buffer flushes"

Full log and config at:

https://build.opensuse.org/package/show/home:AndreasStieger/gzip-broken
https://build.opensuse.org/package/live_build_log/home:AndreasStieger/gzip-broken/openSUSE_Tumbleweed/s390x

> The line numbers don't seem to match the current gzip source code;
> could you please try the latest gzip?

Hmm, this is literally off your master at a6924a2a2, v.1.14 + 1. I put
60f9518 into the errno branch at
https://github.com/andreasstieger/gzip/compare/master...errno

Andreas