Source: make-dfsg Version: 4.2.1-1 Severity: important Tags: patch User: debian-gl...@lists.debian.org Usertags: 2.27
make-dfsg 4.2.1-1 fails to build with glibc 2.27 (2.27-0experimental0 from experimental): | gcc -DHAVE_CONFIG_H -I. -I../../../glob -I.. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o glob.o ../../../glob/glob.c | gcc -DHAVE_CONFIG_H -I. -I../../../glob -I.. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o fnmatch.o ../../../glob/fnmatch.c | ../../../glob/glob.c:581:23: warning: implicit declaration of function '__alloca'; did you mean 'alloca'? [-Wimplicit-function-declaration] | newp = (char *) __alloca (dirlen + 1); | ^~~~~~~~ | alloca | ../../../glob/glob.c:581:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | newp = (char *) __alloca (dirlen + 1); | ^ | ../../../glob/glob.c:709:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | newp = (char *) __alloca (home_len + dirlen); | ^ | ../../../glob/glob.c:732:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | newp = (char *) __alloca (end_name - dirname); | ^ | ../../../glob/glob.c:783:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | newp = (char *) __alloca (home_len + rest_len + 1); | ^ | ../../../glob/glob.c:814:11: warning: implicit declaration of function '__stat'; did you mean '__xstat'? [-Wimplicit-function-declaration] | : __stat (dirname, &st)) == 0 | ^~~~~~ | __xstat | ../../../glob/glob.c: In function 'glob_in_dir': | ../../../glob/glob.c:1256:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1); | ^ | ../../../glob/glob.c:1283:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | names = (struct globlink *) __alloca (sizeof (struct globlink)); | ^ | ../../../glob/glob.c:1341:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | struct globlink *new = (struct globlink *) | ^ | ../../../glob/glob.c:1367:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] | names = (struct globlink *) __alloca (sizeof (struct globlink)); | ^ | rm -f libglob.a | ar cru libglob.a glob.o fnmatch.o | ar: `u' modifier ignored since `D' is the default (see `U') | ranlib libglob.a [...] | gcc -pthread -I/usr/include/guile/2.0 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,--export-dynamic -Wl,-z,relro -o make ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o guile.o implicit.o job.o load.o loadapi.o main.o misc.o output.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o remote-stub.o glob/libglob.a -lguile-2.0 -lgc -ldl | glob/libglob.a(glob.o): In function `glob_in_dir': | ./debian/build-make-guile/glob/../../../glob/glob.c:1367: undefined reference to `__alloca' | ./debian/build-make-guile/glob/../../../glob/glob.c:1342: undefined reference to `__alloca' | ./debian/build-make-guile/glob/../../../glob/glob.c:1283: undefined reference to `__alloca' | ./debian/build-make-guile/glob/../../../glob/glob.c:1256: undefined reference to `__alloca' | glob/libglob.a(glob.o): In function `glob': | ./debian/build-make-guile/glob/../../../glob/glob.c:581: undefined reference to `__alloca' | glob/libglob.a(glob.o):./debian/build-make-guile/glob/../../../glob/glob.c:732: more undefined references to `__alloca' follow | collect2: error: ld returned 1 exit status | Makefile:631: recipe for target 'make' failed | make[4]: *** [make] Error 1 | make[4]: Leaving directory '/<<PKGBUILDDIR>>/debian/build-make-guile' | Makefile:773: recipe for target 'all-recursive' failed | make[3]: *** [all-recursive] Error 1 | make[3]: Leaving directory '/<<PKGBUILDDIR>>/debian/build-make-guile' | Makefile:526: recipe for target 'all' failed | make[2]: *** [all] Error 2 | make[2]: Leaving directory '/<<PKGBUILDDIR>>/debian/build-make-guile' | dh_auto_build: cd debian/build-make-guile && make -j16 returned exit code 2 | debian/rules:40: recipe for target 'override_dh_auto_build' failed | make[1]: *** [override_dh_auto_build] Error 2 | make[1]: Leaving directory '/<<PKGBUILDDIR>>' | debian/rules:22: recipe for target 'build-arch' failed | make: *** [build-arch] Error 2 | dpkg-buildpackage: error: debian/rules build-arch subprocess returned exit status 2 A full build log is available there (from a slightly older version): http://aws-logs.debian.net/2018/02/07/glibc-exp/make-dfsg_4.1-9.1_unstable_glibc-exp.log The problem is that the glibc 2.27 slightly changed its internal glob implementation. make detects that it doesn't support the new interface and switch to its internal implementation which is slightly broken. The attached patch fixes that by backporting two upstream commits which add supports for the new interface.
commit 48c8a116a914a325a0497721f5d8b58d5bba34d4 Author: Paul Smith <psm...@gnu.org> Date: Sun Nov 19 15:09:16 2017 -0500 * configure.ac: Support GLIBC glob interface version 2 commit 193f1e81edd6b1b56b0eb0ff8aa4b41c7b4257b4 Author: Paul Eggert <egg...@cs.ucla.edu> Date: Sun Sep 24 09:12:58 2017 -0400 glob: Do not assume glibc glob internals. It has been proposed that glibc glob start using gl_lstat, which the API allows it to do. GNU 'make' should not get in the way of this. See: https://sourceware.org/ml/libc-alpha/2017-09/msg00409.html * dir.c (local_lstat): New function, like local_stat. (dir_setup_glob): Use it to initialize gl_lstat too, as the API requires. diff --git a/configure.ac b/configure.ac index 8c72568..4710832 100644 --- a/configure.ac +++ b/configure.ac @@ -404,10 +404,9 @@ AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob], #include <glob.h> #include <fnmatch.h> -#define GLOB_INTERFACE_VERSION 1 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 # include <gnu-versions.h> -# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION +# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 gnu glob # endif #endif], diff --git a/dir.c b/dir.c index adbb8a9..c343e4c 100644 --- a/dir.c +++ b/dir.c @@ -1299,15 +1299,40 @@ local_stat (const char *path, struct stat *buf) } #endif +/* Similarly for lstat. */ +#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS) +# ifndef VMS +# ifndef HAVE_SYS_STAT_H +int lstat (const char *path, struct stat *sbuf); +# endif +# else + /* We are done with the fake lstat. Go back to the real lstat */ +# ifdef lstat +# undef lstat +# endif +# endif +# define local_lstat lstat +#elif defined(WINDOWS32) +/* Windows doesn't support lstat(). */ +# define local_lstat local_stat +#else +static int +local_lstat (const char *path, struct stat *buf) +{ + int e; + EINTRLOOP (e, lstat (path, buf)); + return e; +} +#endif + void dir_setup_glob (glob_t *gl) { gl->gl_opendir = open_dirstream; gl->gl_readdir = read_dirstream; gl->gl_closedir = free; + gl->gl_lstat = local_lstat; gl->gl_stat = local_stat; - /* We don't bother setting gl_lstat, since glob never calls it. - The slot is only there for compatibility with 4.4 BSD. */ } void