Re: [PATCH] fstatat: support NULL if AT_EMPTY_PATH
Paul Eggert <[email protected]>
| Newsgroups | gmane.comp.lib.gnulib.bugs |
|---|---|
| Organization | UCLA Computer Science Department |
| Message-ID | <[email protected]> |
On 2026-06-19 09:10, Bruno Haible wrote: > - A missing statement > CFLAGS=$gl_saved_CFLAGS > after the AC_RUN_IFELSE macro. > > - The -Wno-nonnull option surely works only with gcc, clang, and > compatible compilers. How about testing whether -Wno-nonnull > works, first? Thanks for spotting that. That's leftover code from when I was trying to use -Wno-nonnull. I gave up on that idea, as there may in theory be compilers that support __attribute__((__nonnull__ ...)) but lack -Wno-nonnull, and there's little point to optimizing for non-GCC anyway. I installed the attached to fix the problem.
0001-fstatat-don-t-mess-with-CFLAGS.patch
(text/x-patch, 2.4 KB)
From a575239e473656fd0c055a228963bdb48bd0c2cb Mon Sep 17 00:00:00 2001 From: Paul Eggert <[email protected]> Date: Fri, 19 Jun 2026 10:07:47 -0700 Subject: [PATCH] =?UTF-8?q?fstatat:=20don=E2=80=99t=20mess=20with=20CFLAGS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * m4/fstatat.m4 (gl_FUNC_FSTATAT): Remove stray code left over from an aborted attempt to mess with CFLAGS. Problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2026-06/msg00084.html --- ChangeLog | 6 ++++++ m4/fstatat.m4 | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc891e3581..6fd9e8ce38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2026-06-19 Paul Eggert <[email protected]> + fstatat: don’t mess with CFLAGS + * m4/fstatat.m4 (gl_FUNC_FSTATAT): Remove stray code left + over from an aborted attempt to mess with CFLAGS. + Problem reported by Bruno Haible in: + https://lists.gnu.org/r/bug-gnulib/2026-06/msg00084.html + openat2-tests: port to NFS * tests/test-openat2.c (do_test_basic): Close fd before removing its file. This fixes a file descriptor leak, diff --git a/m4/fstatat.m4 b/m4/fstatat.m4 index ceeb211d34..b706c891a4 100644 --- a/m4/fstatat.m4 +++ b/m4/fstatat.m4 @@ -1,5 +1,5 @@ # fstatat.m4 -# serial 6 +# serial 7 dnl Copyright (C) 2004-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -70,9 +70,7 @@ AC_DEFUN([gl_FUNC_FSTATAT], [0], [AC_CACHE_CHECK([whether fstatat+AT_EMPTY_PATH allows null file], [gl_cv_func_fstatat_null_file], - [gl_saved_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Wno-nonnull" - AC_RUN_IFELSE( + [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <stddef.h> #include <fcntl.h> @@ -80,6 +78,8 @@ AC_DEFUN([gl_FUNC_FSTATAT], #ifndef AT_EMPTY_PATH #define AT_EMPTY_PATH 0 #endif + /* Don't check via -Wnonnull, as the problem could in + theory exist with compilers lacking -Wnonnull. */ #if __GLIBC__ && ! (2 < __GLIBC__ + (41 <= __GLIBC_MINOR__)) #error "glibc 2.40 and earlier can fail with null file" #endif -- 2.53.0