Subject: bug#39948: 28.0.50; crash in fchmodat

From: Paul Eggert <[email-masked]>
Date: Fri, 6 Mar 2020 15:54:07 -0800

On 3/6/20 8:45 AM, Robert Pluim wrote:

> lib/fchmodat.c:fchmodat can call lib/fchmodat.c:orig_fchmodat, which
> can call fchmodat. Presumably that last one is meant to be the system
> fchmodat, but itʼs calling the fchmodat.c:fchmodat one instead.

Yes, orig_fchmodat is supposed to call the system fchmodat.

Do you get the same problem with 'make bootstrap'? If not, we're done.

Otherwise, to help debug this please send the preprocessor output when 
compiling lib/fchmodat.c. Something like this:

rm lib/fchmodat.o
make V=1
Now, repeat the GCC command that compiles lib/fchmod.c, except use 'gcc 
-E' instead of 'gcc -c'.

Also, what are the values of HAVE_FCHMODAT (see src/config.h), and of 
GNULIB_FCHMODAT and REPLACE_FCHMODAT (look at the output of the command 
'diff -u lib/sys_stat.in.h lib/sys/stat.h')? Also, please double-check 
lib/gnulib.mk for those three values.

 From your symptoms I would guess for you HAVE_FCHMODAT and 
GNULIB_FCHMODAT are 1 but REPLACE_FCHMODAT is 0. But if that's the case, 
your build shouldn't be compiling lib/fchmodat.c at all, because 
'configure' says this:

   if test $HAVE_FCHMODAT = 0 || test $REPLACE_FCHMODAT = 1; then
     gl_LIBOBJS="$gl_LIBOBJS fchmodat.$ac_objext"
   fi

and so we need to investigate why this 'if' is being triggered,