Xi Ruoyao <[email protected]> writes:

> It can be worked around with
> ac_cv_func_posix_spawn_file_actions_addchdir=yes (which basically tells
> the configure system we have a posix_spawn_file_actions_addchdir, some
> kind of a "fact" with glibc 2.44).
>
> Thoughts on fix this?

Does the attached patch work? In a container, it looks like the symbols
are defined correctly, but I haven't tested it more than that yet:

    $ nm -g --defined-only gllib/libgnu.a | grep spawn_file_actions_add
    0000000000000000 T rpl_posix_spawn_file_actions_addchdir
    0000000000000000 T rpl_posix_spawn_file_actions_addfchdir

Note that I also haven't pushed it yet, since I suspect we will want to
update the outdated commentary to reflect the fact that this is now
standardized. And also consider not compiling these files
unconditionally.

Collin

>From b0b3d5d5518985fad0878ba1a3f63bfcef25f791 Mon Sep 17 00:00:00 2001
Message-ID: <b0b3d5d5518985fad0878ba1a3f63bfcef25f791.1785006655.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 25 Jul 2026 12:09:28 -0700
Subject: [PATCH] posix_spawn_faction_add{chdir,fchdir}: Fix checks on
 glibc-2.44.

Reported by Xi Ruoyao <[email protected]>:
<https://lists.gnu.org/archive/html/bug-gnulib/2026-07/msg00164.html>

* m4/posix_spawn_faction_addchdir.m4
(gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR): Use AC_CHECK_DECLS instead
of AC_CHECK_FUNCS_ONCE.
* m4/posix_spawn_faction_addfchdir.m4
(gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR): Use AC_CHECK_DECLS instead
of AC_CHECK_FUNCS_ONCE.
---
 ChangeLog                           | 12 ++++++++++++
 m4/posix_spawn_faction_addchdir.m4  |  7 ++++---
 m4/posix_spawn_faction_addfchdir.m4 |  7 ++++---
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 97ce480fd9..eb96f263a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-07-25  Collin Funk  <[email protected]>
+
+	posix_spawn_faction_add{chdir,fchdir}: Fix checks on glibc-2.44.
+	Reported by Xi Ruoyao <[email protected]>:
+	<https://lists.gnu.org/archive/html/bug-gnulib/2026-07/msg00164.html>
+	* m4/posix_spawn_faction_addchdir.m4
+	(gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR): Use AC_CHECK_DECLS instead
+	of AC_CHECK_FUNCS_ONCE.
+	* m4/posix_spawn_faction_addfchdir.m4
+	(gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR): Use AC_CHECK_DECLS instead
+	of AC_CHECK_FUNCS_ONCE.
+
 2026-07-25  Paul Eggert  <[email protected]>
 
 	gettext-h: conform to C on Solaris
diff --git a/m4/posix_spawn_faction_addchdir.m4 b/m4/posix_spawn_faction_addchdir.m4
index 779e3813a7..56e33d1a51 100644
--- a/m4/posix_spawn_faction_addchdir.m4
+++ b/m4/posix_spawn_faction_addchdir.m4
@@ -1,5 +1,5 @@
 # posix_spawn_faction_addchdir.m4
-# serial 2
+# serial 3
 dnl Copyright (C) 2018-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,
@@ -11,10 +11,11 @@ AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR]
   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
   AC_REQUIRE([AC_PROG_CC])
   gl_POSIX_SPAWN
-  AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addchdir])
+  AC_CHECK_DECLS([posix_spawn_file_actions_addchdir],,,
+    [[#include <spawn.h>]])
   gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir_np],
     [[#include <spawn.h>]])
-  if test $ac_cv_func_posix_spawn_file_actions_addchdir = yes; then
+  if test $ac_cv_have_decl_posix_spawn_file_actions_addchdir = yes; then
     dnl This function is not yet standardized. Therefore override the
     dnl system's implementation always.
     REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=1
diff --git a/m4/posix_spawn_faction_addfchdir.m4 b/m4/posix_spawn_faction_addfchdir.m4
index e78ea11a88..e8ea9b08b1 100644
--- a/m4/posix_spawn_faction_addfchdir.m4
+++ b/m4/posix_spawn_faction_addfchdir.m4
@@ -1,5 +1,5 @@
 # posix_spawn_faction_addfchdir.m4
-# serial 2
+# serial 3
 dnl Copyright (C) 2018-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,
@@ -11,10 +11,11 @@ AC_DEFUN([gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR]
   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
   AC_REQUIRE([AC_PROG_CC])
   gl_POSIX_SPAWN
-  AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addfchdir])
+  AC_CHECK_DECLS([posix_spawn_file_actions_addfchdir],,,
+    [[#include <spawn.h>]])
   gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addfchdir_np],
     [[#include <spawn.h>]])
-  if test $ac_cv_func_posix_spawn_file_actions_addfchdir = yes; then
+  if test $ac_cv_have_decl_posix_spawn_file_actions_addfchdir = yes; then
     dnl This function is not yet standardized. Therefore override the
     dnl system's implementation always.
     REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR=1
-- 
2.55.0

Reply via email to