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

Tom Tromey
2020-06-18T17:57:31Z

Pedro> I disagree. It's not only GDB's stat usage that counts, it's the
Pedro> other gnulib modules that depend on the stat module fixes too. Also,
Pedro> that approach disables the stat module for all systems, not just
Pedro> mingw. I think it's just bad policy to disable a module like that.

The reason I came to this conclusion is that the list of fixes doesn't
seem to include anything super important; while using it introduces bugs
that are difficult to work around, or even audit for. In particular,
we'll have to be careful to never compare mtime-from-gnulib against
mtime-from-BFD.

Here's the list from the version of gnulib we're using.

Portability problems fixed by Gnulib:
* On platforms where 'off_t' is a 32-bit type, 'stat' may not
correctly report the size of files or block devices larger than 2
GB. (Cf. 'AC_SYS_LARGEFILE'.)
* On Linux/x86 and Linux/x86_64, applications compiled in 32-bit mode
cannot access files that happen to have a 64-bit inode number.
This can occur with file systems such as XFS (typically on large
disks) and NFS. (Cf. 'AC_SYS_LARGEFILE'.)
* The 'st_atime', 'st_ctime', 'st_mtime' fields are affected by the
current time zone and by the DST flag of the current time zone on
some platforms: mingw, MSVC 14 (when the environment variable 'TZ'
is set).
* On MSVC 14, this function fails with error 'ENOENT' on files such
as 'C:\pagefile.sys' and on directories such as 'C:\System Volume
Information'.
* On some platforms, 'stat("link-to-file/",buf)' succeeds instead of
failing with 'ENOTDIR'. FreeBSD 7.2, AIX 7.1, Solaris 9, mingw64.
* On some platforms, 'stat(".",buf)' and 'stat("./",buf)' give
different results: mingw, MSVC 14.
* On Solaris 11.4, when this function yields a timestamp with a
nonpositive 'tv_sec' value, 'tv_nsec' might be in the range
-1000000000..-1, representing a negative nanoseconds offset from
'tv_sec'.

I think the first one is probably not important to gdb; the second is
already working; and the third is a bug. The rest just don't seem very
relevant.

Tom