Subject: Bug#1096467: cpio: ftbfs with GCC-15

From: Matthias Klose <[email-masked]>
Date: Mon, 17 Feb 2025 17:08:10 +0000

Package: src:cpio
Version: 2.15+dfsg-2
Severity: important
Tags: sid forky
User: [email-masked]
Usertags: ftbfs-gcc-15

[This bug is NOT targeted to the upcoming trixie release]

Please keep this issue open in the bug tracker for the package it
was filed for.  If a fix in another package is required, please
file a bug for the other package (or clone), and add a block in this
package. Please keep the issue open until the package can be built in
a follow-up test rebuild.

The package fails to build in a test rebuild on at least amd64 with
gcc-15/g++-15, but succeeds to build with gcc-14/g++-14. The
severity of this report will be raised before the forky release.

The full build log can be found at:
http://qa-logs.debian.net/2025/02/16/amd64exp/cpio_2.15+dfsg-2_unstable_gccexp.log.gz
The last lines of the build log are at the end of this report.

To build with GCC 15, either set CC=gcc-15 CXX=g++-15 explicitly,
or install the gcc, g++, gfortran, ... packages from experimental.

  apt-get -t=experimental install g++ 

GCC 15 now defaults to the C23/C++23 standards, exposing many FTBFS.
Other Common build failures are new warnings resulting in build failures
with -Werror turned on, or new/dropped symbols in Debian symbols files.
For other C/C++ related build failures see the porting guide at
http://gcc.gnu.org/gcc-15/porting_to.html

[...]
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o paxexit.o paxexit.c
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o paxexit-status.o paxexit-status.c
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o rtapelib.o rtapelib.c
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o sysdep.o sysdep.c
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o paxerror.o paxerror.c
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o paxnames.o paxnames.c
rm -f libpax.a
ar cr libpax.a paxexit.o paxexit-status.o rtapelib.o sysdep.o paxerror.o paxnames.o 
ranlib libpax.a
make[4]: Leaving directory '/build/reproducible-path/cpio-2.15+dfsg/lib'
make[3]: Leaving directory '/build/reproducible-path/cpio-2.15+dfsg/lib'
Making all in rmt
make[3]: Entering directory '/build/reproducible-path/cpio-2.15+dfsg/rmt'
gcc -DHAVE_CONFIG_H -I. -I..  -I../gnu -I../ -I../gnu -I../lib -I../paxlib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o rmt.o rmt.c
gcc  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection  -Wl,-z,relro -o rmt rmt.o ../gnu/libgnu.a   
make[3]: Leaving directory '/build/reproducible-path/cpio-2.15+dfsg/rmt'
Making all in src
make[3]: Entering directory '/build/reproducible-path/cpio-2.15+dfsg/src'
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o copyin.o copyin.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o copyout.o copyout.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o copypass.o copypass.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o defer.o defer.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o dstring.o dstring.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o global.o global.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o fatal.o fatal.c
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o main.o main.c
copypass.c: In function ‘process_copy_pass’:
copypass.c:104:12: error: too many arguments to function ‘xstat’; expected 0, have 2
  104 |       if ((*xstat) (input_name.ds_string, &in_file_stat) < 0)
      |           ~^~~~~~~  ~~~~~~~~~~~~~~~~~~~~
gcc -DHAVE_CONFIG_H -I. -I..  -I. -I.. -I../gnu -I../gnu  -I../lib -I../lib -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/cpio-2.15+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -c -o tar.o tar.c
make[3]: *** [Makefile:1866: copypass.o] Error 1
make[3]: *** Waiting for unfinished jobs....
copyout.c: In function ‘process_copy_out’:
copyout.c:647:12: error: too many arguments to function ‘xstat’; expected 0, have 2
  647 |       if ((*xstat) (input_name.ds_string, &file_stat) < 0)
      |           ~^~~~~~~  ~~~~~~~~~~~~~~~~~~~~
main.c: In function ‘parse_opt’:
main.c:407:13: error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(const char * restrict,  struct stat * restrict)’ [-Wincompatible-pointer-types]
  407 |       xstat = stat;
      |             ^
In file included from ../gnu/sys/stat.h:54,
                 from ../lib/system.h:119,
                 from main.c:24:
/usr/include/x86_64-linux-gnu/sys/stat.h:205:12: note: ‘stat’ declared here
  205 | extern int stat (const char *__restrict __file,
      |            ^~~~
main.c: In function ‘process_args’:
main.c:594:9: error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(const char * restrict,  struct stat * restrict)’ [-Wincompatible-pointer-types]
  594 |   xstat = lstat;
      |         ^
/usr/include/x86_64-linux-gnu/sys/stat.h:313:12: note: ‘lstat’ declared here
  313 | extern int lstat (const char *__restrict __file,
      |            ^~~~~
main.c:615:26: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
  615 |       CHECK_USAGE (xstat != lstat, "--dereference", "--extract");
      |                          ^~
main.c:92:6: note: in definition of macro ‘CHECK_USAGE’
   92 |  if (cond) \
      |      ^~~~
make[3]: *** [Makefile:1866: copyout.o] Error 1
make[3]: *** [Makefile:1866: main.o] Error 1
make[3]: Leaving directory '/build/reproducible-path/cpio-2.15+dfsg/src'
make[2]: *** [Makefile:1827: all-recursive] Error 1
make[2]: Leaving directory '/build/reproducible-path/cpio-2.15+dfsg'
make[1]: *** [Makefile:1767: all] Error 2
make[1]: Leaving directory '/build/reproducible-path/cpio-2.15+dfsg'
dh_auto_build: error: make -j8 returned exit code 2
make: *** [debian/rules:4: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2