[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#994102: marked as done (unistd.h: non-null check not correct for getcwd())



Your message dated Tue, 14 Sep 2021 22:04:06 +0000
with message-id <E1mQGX8-000Inn-9h@fasolo.debian.org>
and subject line Bug#993973: fixed in glibc 2.32-3
has caused the Debian Bug report #993973,
regarding unistd.h: non-null check not correct for getcwd()
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
993973: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993973
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6-dev
Version: 2.32-2

Current getcwd() is declared as:

/usr/include/unistd.h:

513:/* Get the pathname of the current working directory,
514:   and put it in SIZE bytes of BUF.  Returns NULL if the
515:   directory couldn't be determined or SIZE was too small.
516:   If successful, returns BUF.  In GNU, if BUF is NULL,
517:   an array is allocated with `malloc'; the array is SIZE
518:   bytes long, unless SIZE == 0, in which case it is as
519:   big as necessary.  */
520:extern char *getcwd (char *__buf, size_t __size) __THROW __wur
521:    __attr_access ((__write_only__, 1, 2));


Documentation (man page) states:

       As an extension to the POSIX.1-2001 standard,  glibc's  getcwd()  allo-
       cates  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.  The caller should free(3)
       the returned buffer.


The current check doesn't accept the NULL pointer with recent GCC
versions and breaks, for example, building GCC from sources due to
fixincl.c using NULL as the buffer argument so it doesn't need to
allocate on its own:

[all 2021-09-11 18:34:38] make[1]: Entering directory '/var/lib/laminar/run/gcc-bfin-elf/6/toolchain-build/build-x86_64-pc-linux-gnu/fixincludes'
[all 2021-09-11 18:34:38] /usr/lib/gcc-snapshot/bin/gcc -c -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wno-overlength-strings -pedantic -Wno-long-long -Werror  -DHAVE_CONFIG_H -I. -I../../../gcc/fixincludes -I../include -I../../../gcc/fixincludes/../include ../../../gcc/fixincludes/fixincl.c
[all 2021-09-11 18:34:39] ../../../gcc/fixincludes/fixincl.c: In function 'process':
[all 2021-09-11 18:34:39] ../../../gcc/fixincludes/fixincl.c:1356:7: error: argument 1 is null but the corresponding size argument 2 value is 4096 [-Werror=nonnull]
[all 2021-09-11 18:34:39]  1356 |       fprintf (stderr, "Cannot access %s from %s\n\terror %d (%s)\n",
[all 2021-09-11 18:34:39]       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[all 2021-09-11 18:34:39]  1357 |                pz_curr_file, getcwd ((char *) NULL, MAXPATHLEN),
[all 2021-09-11 18:34:39]       |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[all 2021-09-11 18:34:39]  1358 |                erno, xstrerror (erno));
[all 2021-09-11 18:34:39]       |                ~~~~~~~~~~~~~~~~~~~~~~~
[all 2021-09-11 18:34:39] In file included from ../../../gcc/fixincludes/system.h:192,
[all 2021-09-11 18:34:39]                  from ../../../gcc/fixincludes/fixlib.h:29,
[all 2021-09-11 18:34:39]                  from ../../../gcc/fixincludes/fixincl.c:24:
[all 2021-09-11 18:34:39] /usr/include/unistd.h:520:14: note: in a call to function 'getcwd' declared with attribute 'access (write_only, 1, 2)'
[all 2021-09-11 18:34:39]   520 | extern char *getcwd (char *__buf, size_t __size) __THROW __wur
[all 2021-09-11 18:34:39]       |              ^~~~~~
[all 2021-09-11 18:34:39] cc1: all warnings being treated as errors
[all 2021-09-11 18:34:39] make[1]: *** [Makefile:76: fixincl.o] Error 1
[all 2021-09-11 18:34:39] make[1]: Leaving directory '/var/lib/laminar/run/gcc-bfin-elf/6/toolchain-build/build-x86_64-pc-linux-gnu/fixincludes'
[all 2021-09-11 18:34:39] make: *** [Makefile:2854: all-build-fixincludes] Error 2

(That's from a not-yet publically announced auto-builder that does
build GCC/Binutils, Linux Kernel, NetBSD and SIMH to check for them
being buildable for a good number of configurations.)

  For comparison, with libc6-dev at 2.31-16, declaration was like this:

504:/* Get the pathname of the current working directory,
505:   and put it in SIZE bytes of BUF.  Returns NULL if the
506:   directory couldn't be determined or SIZE was too small.
507:   If successful, returns BUF.  In GNU, if BUF is NULL,
508:   an array is allocated with `malloc'; the array is SIZE
509:   bytes long, unless SIZE == 0, in which case it is as
510:   big as necessary.  */
511:extern char *getcwd (char *__buf, size_t __size) __THROW __wur;


Until glibc's Bugzilla issue is finally resolved
(https://sourceware.org/bugzilla/show_bug.cgi?id=26545), maybe the
Debian package could be changed to drop the access attribute?

Thanks,
  Jan-Benedict

-- 

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: glibc
Source-Version: 2.32-3
Done: Aurelien Jarno <aurel32@debian.org>

We believe that the bug you reported is fixed in the latest version of
glibc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 993973@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Aurelien Jarno <aurel32@debian.org> (supplier of updated glibc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 14 Sep 2021 23:47:37 +0200
Source: glibc
Architecture: source
Version: 2.32-3
Distribution: unstable
Urgency: medium
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Changed-By: Aurelien Jarno <aurel32@debian.org>
Closes: 993954 993973 994006 994133 994232 994233
Changes:
 glibc (2.32-3) unstable; urgency=medium
 .
   [ John David Anglin ]
   * debian/testsuite-xfail-debian.mk: whitelist test-xfail-tst-cond24 on
     hppa.  Closes: #993954.
 .
   [ Aurelien Jarno ]
   * debian/patches/git-updates.diff: update from upstream stable branch.
   * debian/debhelper.in/libc.preinst: drop fragile check for working debconf
     frontend now that it is done directly in debconf (see bug#985572) and now
     that this version is available in Bullseye.
   * debian/control.in/libc: add a Breaks against aide (<< 0.17.3-4+b3). See
     bug#994091.
   * debian/debhelper.in/libc.preinst: force systemd-logind to do NSS lookups
     to workaround the impossibility of restarting systemd-logind.  Closes:
     #994006.
   * debian/control.in/libc: add a Breaks against python3-iptables (<<
     1.0.0-2).  Closes: #994233.
   * debian/patches/all/submitted-po-fr-fixes.diff: fix French translation of
     short options.  Closes: #994133.
   * debian/control.in/libc: add a Breaks against fakechroot (<< 2.19-3.5).
     See bug#993946.
   * debian/control.in/libc: add a Breaks against dazzdb
     (<< 1.0+git20201103.8d98c37-1.1). See bug#993770.
   * debian/patches/git-updates.diff: update from upstream stable branch.
   * debian/patches/any/submitted-getcwd-gnu-extension-warning.diff: fix
     a warning when using the GNU extension of getcwd(). This is a TEMPORARY
     fix until upstream takes a decision on the removal of this extension. This
     might be REMOVED at a later point, in that case packages should be fixed
     instead, like other distributions have already done.  Closes: #993973.
 .
   [ Simon McVittie ]
   * debian/libc6-i386.symbols.x32, debian/libc6.symbols.mips,
     debian/libc6.symbols.mipsel: fix too aggressive cleanup, leading
     unnecessarily tight dependencies on libc6.  Closes: #994232.
Checksums-Sha1:
 022b0094d410d34fabb6dcacec1c8c3ca09d8ec6 9617 glibc_2.32-3.dsc
 5aa6bd51d95c9bfe686a0442c262c2d998414194 841548 glibc_2.32-3.debian.tar.xz
 b6e714bfec8d51f72c5751fe366d565ee265db36 8656 glibc_2.32-3_source.buildinfo
Checksums-Sha256:
 1ea4b7640d359f14c32c0f0019b7b78c58cf4c13f005afee4289a615e8b4459e 9617 glibc_2.32-3.dsc
 5c4e9a38bca7644718a4b6477cc20c9c395b1bfa10e15e62763762cf4d308f73 841548 glibc_2.32-3.debian.tar.xz
 3d42a71fde7d7c5fbb354eca2aabc523d8b94b7411044994d2886bd61aaf57f0 8656 glibc_2.32-3_source.buildinfo
Files:
 0322476076e3cd67c563694a786b1d3e 9617 libs required glibc_2.32-3.dsc
 b74626d5d5e7f61bba8b103489ff33d7 841548 libs required glibc_2.32-3.debian.tar.xz
 3b69e23588f27d31e4af4caf675a0250 8656 libs required glibc_2.32-3_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEUryGlb40+QrX1Ay4E4jA+JnoM2sFAmFBGjUACgkQE4jA+Jno
M2ve2g/+J/GEgt0M7LxtEgshqcpj5qOMZYTol3zbWs1rzesITE+F+Wf4cCTe6sJH
67zVhCt1H1JkT45rOUg3y/l7EJjgt1f4wSmh+61ddmFWH+a+tcVYw5hkSbiWTswt
g+rjK6v4b0pjkOUMUiJ4bcJ8E9WO+sPpI2csia0BbFjiavxu/zT4jsVlIE1HH0Bt
xXnu+fpr5b2mvZpWPv941hZ/6+da+otRXMd/Xp9IWJUlZ2yvj/4PN8E9onExFGWK
9bpJOI7PqeJsfJyfAKCWeeV40uzNytlapwpV4w8WVKJVsZzAWsw9vrvnvMwX2Sp0
mglmkX83nuOJa6d0FEPAwHYZmMwKNgBDYuQQFe+0DWlUOwqF4Ff+HA8RCsZGcT5T
kmZTdiQEKBJcA4+wfxsz/PDumlQxOM8LAK9xpPIq/qE3emAS2+QSSMAgwrbQkQ+C
ck6plYBi8+nrXJqIT9KJDvlq2Kv+0KFHUB+KpfRr+e3wi2XiCnrQ/fQPp3zfssaM
/uJvFHTuXDEgzBOtUe2YTHjlb7PsUIlMVhuQ0egQWA2TA3z94n3xzp3OfTCr3Qpz
g5iUq4co6UJN/YTWg5NKRF0oiOPJtSZALOjQX1oTD1s+LaIX30mQkSd/slUI+byT
9+iZgfP5YIEmTmdZQ4JFttYs7BE4YPn4mlEHw5+r+rCg2ya2BVo=
=z36O
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: