Re: [PATCH 2/3] Consistently use BFD's time

Eli Zaretskii
2020-01-18T07:58:39Z

> From: Tom Tromey <tromey@adacore.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, Christian Biesinger <cbiesinger@google.com>, palves@redhat.com, gdb-patches@sourceware.org
> Date: Fri, 17 Jan 2020 13:55:57 -0700
>
> >>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> Eli> I wonder whether a better way is not to import the Gnulib 'stat' and
> Eli> 'fstat' modules at all. Are they required by other Gnulib modules,
> Eli> and if so, by which ones?
>
> Tom> I am wondering this as well. While I think we can track down the bad
> Tom> spots -- either calling the "wrong" stat or incorrectly comparing values
> Tom> from the different stats (the patches I sent probably accomplish the
> Tom> latter already) -- it seems fragile to rely on this.
>
> It came in originally in a patch I sent and one that Yao sent:
>
> https://sourceware.org/ml/gdb-patches/2013-11/msg00502.html

This one removed gdb_stat.h, which had replacements for the S_IS*
macros, something that should be easy to bring back, and doesn't
really justify replacing the functions and the struct's themselves.

> https://sourceware.org/ml/gdb-patches/2014-11/msg00654.html

This seems to be about using 'lstat' freely. But I see only one call
to 'lstat' in our sources -- in symfile.c. So maybe having our own
replacement, or even calling 'lstat' conditioned by an #ifdef, would
be a good-enough solution.

> I thought maybe removing these workarounds would be ok, but it seems
> like it can't be done: when I remove stat and lstat from
> update-gnulib.sh, they still appear.
>
> Maybe --avoid=stat will work.

I guess this means some other Gnulib module pulls in 'stat', in which
case --avoid=stat is the way to try to avoid it, yes. (My guess is
that the 'largefile' module causes 'stat' to be pulled in.)