Hi,

When I perform a full system rebuild with glibc-2.44 I notice m4-1.4.21
test suite cannot finish.  Investigate shows the problem is a
posix_spawn_file_actions_addchdir_np infinitely recursively calling
itself.  The root cause is:

- gnulib posix_spawn_faction_addchdir.m4 has:

AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addchdir])

and:

  if test $ac_cv_func_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
  else
    HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR=0
  fi  

So it's checking the existence of posix_spawn_file_actions_addchdir w/o
including any headers.

- glibc-2.44 spawn.h has:

/* Add an action changing the directory to PATH during spawn.  This
   affects the subsequent file actions.
   Alias of posix_spawn_file_actions_addchdir_np.  */
extern int __REDIRECT_NTH (posix_spawn_file_actions_addchdir,
                            (posix_spawn_file_actions_t * __restrict __actions,
                             const char *__restrict __path),
                            posix_spawn_file_actions_addchdir_np);

This preprocess (with -D_GNU_SOURCE) to:

extern int posix_spawn_file_actions_addfchdir (
    posix_spawn_file_actions_t *,
    int __fd) __asm__ (""
                       "posix_spawn_file_actions_addfchdir_np")
    __attribute__ ((__nothrow__, __leaf__));
                                                                ;
I.e. libc.so.6 does not have posix_spawn_file_actions_addchdir symbol,
but this header magic makes GCC replace every occurrence of
posix_spawn_file_actions_addfchdir in the symtab with
posix_spawn_file_actions_addfchdir_np.

So AC_CHECK_FUNCS_ONCE([posix_spawn_file_actions_addchdir]) will return
"posix_spawn_file_actions_addchdir is NOT defined" and then
REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR will be NOT set.

- gnulib spawn_faction_addchdir.c has:

int
posix_spawn_file_actions_addchdir (posix_spawn_file_actions_t *file_actions,
                                   const char *path)
#undef posix_spawn_file_actions_addchdir
{
#if !REPLACE_POSIX_SPAWN
  return posix_spawn_file_actions_addchdir_np (file_actions, path);
#else

... ...

As REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR is not set,
posix_spawn_file_actions_addchdir is not defined to
rpl_posix_spawn_file_actions_addchdir.

So spawn_faction_addchdir.c ends up:

int
posix_spawn_file_actions_addchdir (posix_spawn_file_actions_t *file_actions,
                                   const char *path)
{
  return posix_spawn_file_actions_addchdir_np (file_actions, path);
}

and remember the symtab hack... this efficiently becomes:

int
posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t *file_actions,
                                      const char *path)
{
  return posix_spawn_file_actions_addchdir_np (file_actions, path);
}

:-(

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?

-- 
Xi Ruoyao <[email protected]>

Reply via email to