On 2026-06-23 11:01, Bruno Haible wrote:
Yesterday's CI of GNU m4 (newest m4 sources, newest gnulib sources, on
Alpine Linux) shows a test failure:


FAIL: test-fstatat
==================

Segmentation fault (core dumped)
FAIL test-fstatat (exit status: 139)


I reproduce it in Alpine Linux 3.24.1 (but not in 3.22 nor 3.20).

Thanks for the bug report. Unfortunately portal.cfarm.net lists only Alpine 3.22 and 3.23.

Was this a crosscompile, or native? Was it x86-64 or some other platform? Is the build log public?


The backtrace is:
   test-fstatat.c:111
     -> musl/src/stat/fstatat.c:147
        -> musl/src/stat/fstatat.c:81

That line reads:
         if (flag==AT_EMPTY_PATH && fd>=0 && !*path) {

The backtrace suggests that REPLACE_FSTATAT was 0, because there is no rentry for Gnulib's lib/fstatat.c. However, REPLACE_FSTATAT should have been 1 because the musl source code doesn't support AT_EMPTY_PATH with a null pointer .

Can you verify whether fstatat is being replaced by checking that m4/lib/sys/stat.h contains lines like the following?

  #if 1
  # if 1
  #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  #   undef fstatat
  #   define fstatat rpl_fstatat
  #  endif
  _GL_FUNCDECL_RPL (fstatat, int,

Can you look in config.log for lines like the following?

  ... checking whether fstatat+AT_EMPTY_PATH allows null file
  ...
  ... result: yes

What happens when you compile and run the following program? What's the tail of "strace ./a.out"? (This is the program 'configure' should be running to see whether AT_EMPTY_PATH works with a null pointer.)

  #include <stddef.h>
  #include <fcntl.h>
  #include <sys/stat.h>
  #ifndef AT_EMPTY_PATH
  # define AT_EMPTY_PATH 0
  #endif
  #if __GLIBC__ && ! (2 < __GLIBC__ + (41 <= __GLIBC_MINOR__))
   #error "glibc 2.40 and earlier can fail with null file"
  #endif

  int
  main (void)
  {
    struct stat st;
    return
      (AT_EMPTY_PATH
       && fstatat (AT_FDCWD, NULL, &st, AT_EMPTY_PATH) < 0);
  }

What is the output of the shell command 'nm -g lib/libm4_a-fstatat.o'?

Your bug report prompted me to update GNU m4's Gnulib to the current version, and fix some glitches I noticed on Fedora 44. But I don't think this fixed your bug.

Reply via email to