bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libgnu: rpl_getcwd broken on OpenBSD 4.6


From: Mats Erik Andersson
Subject: Re: libgnu: rpl_getcwd broken on OpenBSD 4.6
Date: Fri, 18 Nov 2011 23:54:30 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Dear Paul,

fredag den 18 november 2011 klockan 12:52 skrev Paul Eggert detta:
> On 11/18/11 12:07, Mats Erik Andersson wrote:
> 
> > The [fstatat] module is built, but not automatically included in "libgnu.a".
> 
> OK, thanks.  Now we need to find out why that problem is happening.

Recently Bruno Haible made several platform tests of our snapshot:

   http://lists.gnu.org/archive/html/bug-inetutils/2011-11/msg00001.html

He mentioned fstatat issues in Mac OX X, FreeBSD, mingw.
The issue in OpenBSD was masked by another omission.

> The fstatat module lists this in its configure.ac section:
> 
> gl_FUNC_FSTATAT
> if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
>   AC_LIBOBJ([fstatat])
> fi
> AC_REQUIRE([AC_C_INLINE]) dnl because 'inline' is used in lib/openat.h
> gl_MODULE_INDICATOR([fstatat]) dnl for lib/openat.h
> gl_SYS_STAT_MODULE_INDICATOR([fstatat])
> 
> The AC_LIBOBJ([fstatat]) should put the fstatat module into libgnu.a.
> Can you see why it is not having its intended
> effect?  You might look into config.log for starters.

No macro "fstatat" is ever defined; see below.

> Also, can you double-check libgnu.a for all occurrences of fstatat
> and/or rpl_fstatat?  Something like "nm -o libgnu.a | grep fstatat",
> or whatever the moral equivalent of that is, on OpenBSD.

$ nm -o lib/libgnu.a | grep fstatat
fstatat.o:         U __errno
fstatat.o:         U __guard
fstatat.o:         U __stack_smash_handler
fstatat.o:         U fchdir
fstatat.o:         U free
fstatat.o:         U free_cwd
fstatat.o:00000000 F fstatat.c
fstatat.o:         U lstat
fstatat.o:         U openat_proc_name
fstatat.o:         U openat_restore_fail
fstatat.o:         U openat_save_fail
fstatat.o:         U restore_cwd
fstatat.o:00000000 T rpl_fstatat
fstatat.o:         U save_cwd
fstatat.o:         U stat
getcwd.o:         U fstatat

Intermission: rpl_fstatat() exists, but not fstatat().

/*
 * config.h
 */
#define GNULIB_FSTATAT 1
#define GNULIB_TEST_FSTATAT 1
/* #undef HAVE_FSTATAT */
/* #undef HAVE_RAW_DECL_FSTATAT */
/* #undef HAVE_WORKING_FSTATAT_ZERO_FLAG */

/*
 * lib/fstatat.c
 */
# if ! HAVE_WORKING_FSTATAT_ZERO_FLAG
#  define AT_FUNC_NAME rpl_fstatat
# else
#  define AT_FUNC_NAME fstatat
# endif

Intermission: This is probably broken. I recommend a positive logic:

   # if HAVE_WORKING_FSTATAT_ZERO_FLAG
   #  define AT_FUNC_NAME fstatat
   # else
   #  define AT_FUNC_NAME rpl_fstatat
   # endif

At least an improved detection is needed in negative logic:

   # if ! defined HAVE_WORKING_FSTATAT_ZERO_FLAG \
          || ! HAVE_WORKING_FSTATAT_ZERO_FLAG
   #  define AT_FUNC_NAME rpl_fstatat
   # else
   #  define AT_FUNC_NAME fstatat
   # endif

Now take notice of REPLACE_FSTATAT in the build file
after configuration.

/*
 * Makefile
 */
GNULIB_FSTATAT = 1
HAVE_FSTATAT = 0
REPLACE_FSTATAT = 0

/*
 * lib/sys/stat.h
 */
#if 1   /* GNULIB_FSTATAT */
# if 0  /* REPLACE_FSTATAT */
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   undef fstatat
#   define fstatat rpl_fstatat
#  endif

In effect, this says

   /* rpl_fstatat() is never replacing fstatat() */
   #if 0
   #  define fstatat rpl_fstatat
   #endif

Conclusion: The computation of REPLACE_FSTATAT is broken.

Should it be something like the following?

   /*
    * lib/sys_stat.in.h
    */
   #if @GNULIB_FSTATAT@
   # if @REPLACE_FSTATAT@ || ! @HAVE_FSTATAT@


Best regards,
  Mats E A



reply via email to

[Prev in Thread] Current Thread [Next in Thread]