FTBFS: nss for groovy ftbfs due to erroneous nonnull check arising from glibc getcwd() annotation

Bug #1897666 reported by Alex Murray
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nss (Ubuntu)
Fix Released
High
Unassigned

Bug Description

As per the archive test rebuild done recently by doko, nss FTBFS due to a compiler warning raised by gcc-10 (and this fails the build due to the use of -Werror in CFLAGS):

https://launchpad.net/ubuntu/+archive/test-rebuild-20200925-groovy/+build/20033437

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

According to the upstream bug report at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96832 this would appear to be because of the annotation of getcwd() with the access attribute. However, there seems to be some debate about the best way to resolve this (whether in glibc or in the callers of getcwd, ie nss) for now I propose to just disable this check via the use of gcc's #pragma directive.

Tags: ftbfs patch
Revision history for this message
Alex Murray (alexmurray) wrote :

See attached for a debdiff (note this uses ubuntu3 instead of ubuntu2 since I already burned that version in the security-proposed PPA whilst preparing this)

tags: added: ftbfs
Revision history for this message
Alex Murray (alexmurray) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "nss_3.55-1ubuntu3.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Changed in nss (Ubuntu):
status: New → Fix Committed
Mathew Hodson (mhodson)
Changed in nss (Ubuntu):
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nss - 2:3.55-1ubuntu3

---------------
nss (2:3.55-1ubuntu3) groovy; urgency=medium

  * Fix FTBFS due to erroneous glibc out-of-bounds checking with gcc 10
    (LP: #1897666)
    - debian/patches/fix-ftbfs-glibc-invalid-oob-error.patch: Disable
      non-null error checking on call to getcwd since this results in an
      erroneous warning that causes the build to fail otherwise

 -- Alex Murray <email address hidden> Tue, 29 Sep 2020 10:39:29 +0930

Changed in nss (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.