Hi,
Colin Watson wrote:
> I'm in the process of making my man-db package use Gnulib. Upon
> importing the xgetcwd module and using it
Have you done a "make distclean" and reconfigured after doing this?
> I found that calling xgetcwd caused infinite recursion:
>
> #34894 0x0805cc1e in getcwd (buf=0x0, size=0) at getcwd.c:157
> #34895 0x0805cc1e in getcwd (buf=0x0, size=0) at getcwd.c:157
> #34896 0x0805ca0b in xgetcwd () at xgetcwd.c:37
> #34897 0x08050a6a in main (argc=2, argv=0xbfe7bc04) at man.c:726
>
> configure defines HAVE_PARTLY_WORKING_GETCWD on my system, namely Debian
> unstable with glibc 2.6.1. I note that lib/getcwd.c says (much reduced
> for brevity):
>
> #if !_LIBC
> # define __getcwd getcwd
> #endif
>
> char *
> __getcwd (char *buf, size_t size)
> {
> #if HAVE_PARTLY_WORKING_GETCWD
> # undef getcwd
> dir = getcwd (buf, size);
> #endif
>
> Isn't this bound to break with HAVE_PARTLY_WORKING_GETCWD && !LIBC? The
> function definition preprocesses to char *getcwd.
The expected behaviour is that __getwcd expands to getcwd which in turns
expands to rpl_getcwd. If getcwd does not expand to rpl_getcwd, you need
to find out why. Look at the value of REPLACE_GETCWD in your config.status
and at the differences between lib/unistd.in.h (or lib/unistd_.h) and
lib/unistd.h.
Bruno