reassign 993973 libc6-dev
found 993973 2.32-1
thanks

On Thu, Sep 09, 2021 at 12:21:52AM +0200, Helmut Grohne wrote:
> Source: nss
> Version: 2:3.70-1
> Severity: serious
> Tags: ftbfs
> X-Debbugs-Cc: debian-gl...@lists.debian.org
> 
> A native build of nss now fails as follows:
> 
> | x86_64-linux-gnu-gcc -o OBJS/nsinstall.o -c -std=c99 -g -g -fPIC   -pipe 
> -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall 
> -Wshadow -Werror -DXP_UNIX -DXP_UNIX -DDEBUG -UNDEBUG -D_DEFAULT_SOURCE 
> -D_BSD_SOURCE -D_POSIX_SOURCE -DSDB_MEASURE_USE_TEMP_DIR -D_REENTRANT -DDEBUG 
> -UNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE 
> -DSDB_MEASURE_USE_TEMP_DIR -D_REENTRANT -DNSS_NO_INIT_SUPPORT 
> -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT 
> -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/<<PKGBUILDDIR>>/dist/include 
> -I/<<PKGBUILDDIR>>/dist/public/coreconf 
> -I/<<PKGBUILDDIR>>/dist/private/coreconf  nsinstall.c
> | nsinstall.c: In function ‘main’:
> | nsinstall.c:70:16: error: argument 1 is null but the corresponding size 
> argument 2 value is 4096 [-Werror=nonnull]
> |    70 | #define GETCWD getcwd
> |       |                ^
> | nsinstall.c:239:8: note: in expansion of macro ‘GETCWD’
> |   239 |  cwd = GETCWD(0, PATH_MAX);
> |       |        ^~~~~~
> | In file included from nsinstall.c:20:
> | /usr/include/unistd.h:520:14: note: in a call to function ‘getcwd’ declared 
> with attribute ‘write_only (1, 2)’
> |   520 | extern char *getcwd (char *__buf, size_t __size) __THROW __wur
> |       |              ^~~~~~
> | nsinstall.c:70:16: error: argument 1 is null but the corresponding size 
> argument 2 value is 4096 [-Werror=nonnull]
> |    70 | #define GETCWD getcwd
> |       |                ^
> | nsinstall.c:246:13: note: in expansion of macro ‘GETCWD’
> |   246 |     todir = GETCWD(0, PATH_MAX);
> |       |             ^~~~~~
> | In file included from nsinstall.c:20:
> | /usr/include/unistd.h:520:14: note: in a call to function ‘getcwd’ declared 
> with attribute ‘write_only (1, 2)’
> |   520 | extern char *getcwd (char *__buf, size_t __size) __THROW __wur
> |       |              ^~~~~~
> | cc1: all warnings being treated as errors
> | make[2]: *** [../../coreconf/rules.mk:292: OBJS/nsinstall.o] Error 1
> | make[2]: Leaving directory '/<<PKGBUILDDIR>>/nss/coreconf/nsinstall'
> | make[1]: *** [debian/rules:100: override_dh_auto_build] Error 2
> | make[1]: Leaving directory '/<<PKGBUILDDIR>>'
> | make: *** [debian/rules:195: build] Error 2
> | dpkg-buildpackage: error: debian/rules build subprocess returned exit 
> status 2
> 
> It looks very much like this is due to the glibc 2.32 upload. My reading
> of man getcwd is that the call of nss is legit (as a glibc extension).
> Maybe this is a glibc bug?

Quoting man getcwd:

  As an extension to the POSIX.1-2001 standard, glibc's getcwd() allocates
  the buffer dynamically using malloc(3) if buf is NULL. In this case, the
  allocated buffer has the length size unless size is zero, when buf is
  allocated as big as necessary

But that's from manpages-dev. The documentation from glibc itself says:

  The GNU C Library version of this function also permits you to specify
  a null pointer for the buffer argument. Then getcwd allocates a buffer
  automatically, as with malloc (see Unconstrained Allocation). If the
  size is greater than zero, then the buffer is that large; otherwise,
  the buffer is as large as necessary to hold the result. 

Which is essentially the same thing. The unistd.h header itself says:

  In GNU, if BUF is NULL, an array is allocated with `malloc'; the array
  is SIZE bytes long, unless SIZE == 0, in which case it is as big as
  necessary.

This doesn't fit with the use of __attribute__((access(write_only(1, 2))))
IMO.

Mike

Reply via email to