Package: checkinstall
Version: 1.6.2+git20170426.d24a630-2
Severity: serious
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu  ubuntu-patch
X-Debbugs-Cc: sl...@ubuntu.com

Dear Maintainer,

checkinstall fails to build from source with the following error if
compiled with glibc 2.33+:

gcc -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 
-ffile-prefix-map=/<<BUILDDIR>>/checkinstall-1.6.2+git20170426.d24a630=. 
-flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat 
-Werror=format-security -Wl,-Bsymbolic-functions -flto=auto -Wl,-z,relro -Wall 
-c -g -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"0.7.0beta7\" 
installwatch.c
installwatch.c: In function ‘true_stat’:
installwatch.c:162:27: error: ‘_STAT_VER’ undeclared (first use in this 
function)
  162 |         return true_xstat(_STAT_VER,pathname,info);
      |                           ^~~~~~~~~
installwatch.c:162:27: note: each undeclared identifier is reported only once 
for each function it appears in
installwatch.c: In function ‘true_mknod’:
installwatch.c:166:28: error: ‘_MKNOD_VER’ undeclared (first use in this 
function)
  166 |         return true_xmknod(_MKNOD_VER,pathname,mode,&dev);
      |                            ^~~~~~~~~~
installwatch.c: In function ‘true_lstat’:
installwatch.c:170:28: error: ‘_STAT_VER’ undeclared (first use in this 
function)
  170 |         return true_lxstat(_STAT_VER,pathname,info);
      |                            ^~~~~~~~~
installwatch.c: In function ‘true_fstatat’:
installwatch.c:174:30: error: ‘_STAT_VER’ undeclared (first use in this 
function)
  174 |         return true_fxstatat(_STAT_VER, dirfd, pathname, info, flags);
      |                              ^~~~~~~~~
installwatch.c: In function ‘true_fstatat64’:
installwatch.c:178:32: error: ‘_STAT_VER’ undeclared (first use in this 
function)
  178 |         return true_fxstatat64(_STAT_VER, dirfd, pathname, info, flags);
      |                                ^~~~~~~~~
installwatch.c: In function ‘true_mknodat’:
installwatch.c:182:30: error: ‘_MKNOD_VER’ undeclared (first use in this 
function)
  182 |         return true_xmknodat(_MKNOD_VER, dirfd, pathname, mode, &dev);
      |                              ^~~~~~~~~~
installwatch.c: In function ‘instw_init’:
installwatch.c:1211:17: warning: ignoring return value of ‘realpath’ declared 
with attribute ‘warn_unused_result’ [-Wunused-result]
 1211 |                 realpath(proot,wrkpath);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
installwatch.c:1330:17: warning: ignoring return value of ‘realpath’ declared 
with attribute ‘warn_unused_result’ [-Wunused-result]
 1330 |                 realpath(__instw.root,wrkpath);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
installwatch.c:1348:25: warning: ignoring return value of ‘realpath’ declared 
with attribute ‘warn_unused_result’ [-Wunused-result]
 1348 |                         realpath(pexclude,wrkpath);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
installwatch.c: In function ‘true_stat’:
installwatch.c:163:1: warning: control reaches end of non-void function 
[-Wreturn-type]
  163 | }
      | ^
installwatch.c: In function ‘copy_path’:
installwatch.c:757:33: warning: ignoring return value of ‘write’ declared with 
attribute ‘warn_unused_result’ [-Wunused-result]
  757 |                                 write(translfd,buffer,bytes);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
installwatch.c: In function ‘true_lstat’:
installwatch.c:171:1: warning: control reaches end of non-void function 
[-Wreturn-type]
  171 | }
      | ^
installwatch.c: In function ‘true_mknod’:
installwatch.c:167:1: warning: control reaches end of non-void function 
[-Wreturn-type]
  167 | }
      | ^
make[3]: *** [Makefile:22: installwatch.o] Error 1
make[3]: Leaving directory 
'/<<BUILDDIR>>/checkinstall-1.6.2+git20170426.d24a630/installwatch'
make[2]: *** [Makefile:12: all] Error 2
make[2]: Leaving directory 
'/<<BUILDDIR>>/checkinstall-1.6.2+git20170426.d24a630'
dh_auto_build: error: make -j4 "INSTALL=install --strip-program=true" returned 
exit code 2
make[1]: *** [debian/rules:10: override_dh_auto_build] Error 25
make[1]: Leaving directory 
'/<<BUILDDIR>>/checkinstall-1.6.2+git20170426.d24a630'
make: *** [debian/rules:7: build] Error 2
dpkg-buildpackage.pl: error: debian/rules build subprocess returned exit status 
2


In Ubuntu, the attached patch was applied to achieve the following:

  * Fix FTBFS with glibc 2.33+ (dropped definitions of _STAT_VER & _MKNOD_VER)


Thanks for considering the patch.

Cheers,
  Lukas


-- System Information:
Debian Release: 11.0
  APT prefers impish
  APT policy: (500, 'impish')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.13.0-16-generic (SMP w/4 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE:en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
checkinstall-1.6.2+git20170426.d24a630/debian/patches/0016-Define-_STAT_VER-_MKNOD_VER-locally-dropped-in-glibc.patch
 
checkinstall-1.6.2+git20170426.d24a630/debian/patches/0016-Define-_STAT_VER-_MKNOD_VER-locally-dropped-in-glibc.patch
--- 
checkinstall-1.6.2+git20170426.d24a630/debian/patches/0016-Define-_STAT_VER-_MKNOD_VER-locally-dropped-in-glibc.patch
       1970-01-01 01:00:00.000000000 +0100
+++ 
checkinstall-1.6.2+git20170426.d24a630/debian/patches/0016-Define-_STAT_VER-_MKNOD_VER-locally-dropped-in-glibc.patch
       2021-10-14 15:57:27.000000000 +0200
@@ -0,0 +1,50 @@
+From: =?utf-8?q?Lukas_M=C3=A4rdian?= <sl...@ubuntu.com>
+Date: Thu, 14 Oct 2021 15:26:10 +0200
+Subject: Define _STAT_VER & _MKNOD_VER locally (dropped in glibc 2.33)
+
+In glibc 2.33, they've removed the _STAT_VER and _MKNOD_VER definitions
+from public headers. They have no plans to add these back so checkinstall
+needs to attempt its own definitions. There is some protection as if they
+were wrong and there was a mismatch, we'd get an error at runtime.
+
+Removed in upstream glibc:
+https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8ed005daf0ab03e142500324a34087ce179ae78e
+
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+---
+ installwatch/installwatch.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/installwatch/installwatch.c b/installwatch/installwatch.c
+index b145e03..a55335e 100644
+--- a/installwatch/installwatch.c
++++ b/installwatch/installwatch.c
+@@ -158,6 +158,27 @@ static int (*true_unlinkat)(int, const char *, int);
+       #define inline
+ #endif        
+ 
++#ifndef _STAT_VER
++ #if defined (__aarch64__)
++  #define _STAT_VER 0
++ #elif defined (__s390x__)
++  # define _STAT_VER 1
++ #elif defined (__x86_64__)
++  #define _STAT_VER 1
++ #else
++  #define _STAT_VER 3
++ #endif
++#endif
++#ifndef _MKNOD_VER
++ #if defined (__aarch64__)
++  #define _MKNOD_VER 0
++ #elif defined (__x86_64__)
++  #define _MKNOD_VER 0
++ #else
++  #define _MKNOD_VER 1
++ #endif
++#endif
++
+ static inline int true_stat(const char *pathname,struct stat *info) {
+       return true_xstat(_STAT_VER,pathname,info);
+ }
diff -Nru checkinstall-1.6.2+git20170426.d24a630/debian/patches/series 
checkinstall-1.6.2+git20170426.d24a630/debian/patches/series
--- checkinstall-1.6.2+git20170426.d24a630/debian/patches/series        
2019-09-29 01:09:32.000000000 +0200
+++ checkinstall-1.6.2+git20170426.d24a630/debian/patches/series        
2021-10-14 15:57:27.000000000 +0200
@@ -9,3 +9,4 @@
 0013-fix-installcheck-tests.patch
 0014-fix-xstat64.patch
 0015-add-renameat2.patch
+0016-Define-_STAT_VER-_MKNOD_VER-locally-dropped-in-glibc.patch

Reply via email to