Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tom@tromey.com>
Cc: tromey@adacore.com, gdb-patches@sourceware.org, palves@redhat.com
Subject: Re: [PATCH 2/3] Consistently use BFD's time
Date: Thu, 18 Jun 2020 18:04:01 +0300	[thread overview]
Message-ID: <83r1ucza8u.fsf@gnu.org> (raw)
In-Reply-To: <87k1044g1x.fsf@tromey.com> (message from Tom Tromey on Thu, 18 Jun 2020 08:14:18 -0600)

> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org,
>  Pedro Alves <palves@redhat.com> 
> Date: Thu, 18 Jun 2020 08:14:18 -0600
> 
> Eli> There's one more potential issue with Gnulib's replacement of 'fstat':
> Eli> it also replaces the definition of 'struct stat', and it does that in
> Eli> a way that might yield incompatibility between the definition on
> Eli> <sys/stat.h> the system header and Gnulib's sys/stat.h replacement.
> 
> I am looking into this issue again for the upcoming gdb 10 release.
> 
> Looking at the gnulib in the gdb tree, as far as I can tell, it doesn't
> actually override struct stat.  The code is all there:
> 
>     /* Optionally, override 'struct stat' on native Windows.  */
>     #if @GNULIB_OVERRIDES_STRUCT_STAT@
>     [...]
> 
> ... however, this is only ever set to 0 in our tree:
> 
>     $ git grep 'GNULIB_OVERRIDES_STRUCT_STAT.*=' -- gnulib/import/
>     gnulib/import/Makefile.in:GNULIB_OVERRIDES_STRUCT_STAT = @GNULIB_OVERRIDES_STRUCT_STAT@
>     gnulib/import/m4/sys_stat_h.m4:  GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT])
> 
> (I chose a tighter grep for the purposes of posting, but in reality I
> looked at all mentions of GNULIB_OVERRIDES_STRUCT_STAT.)
> 
> So, I think this is maybe not an issue.

I meant a different part of Gnulib's sys/stat.h:

  /* Large File Support on native Windows.  */
  #if @WINDOWS_64_BIT_ST_SIZE@
  # define stat _stati64
  #endif

This will also redirect 'struct stat' to 'struct _stati64', which has
a 64-bit st_size and a 64-bit st_mtime (and other times) members.  And
by default @WINDOWS_64_BIT_ST_SIZE@ evaluates to 1 in the MinGW build.

This might not be a problem when building with MinGW64, but my GDB
builds are 32-bit, and I want to use the default version of 'struct
stat', where both the st_size and the time-related members are 32-bit
wide.  Therefore, I had a problem with the above redirection.

In case you need to refresh your memory, I explained all that in more
detail here:

  https://sourceware.org/pipermail/gdb-patches/2020-January/164882.html

> The timezone thing, however, remains an issue.  It seems dangerous to me
> that we would have two implementations of stat that would give different
> answers.  It's too easy, IMO, to accidentally compare values from one
> with values from the other -- in fact, that's what lead to the patches
> in this thread I'm replying to.

I agree.

> Based on this, my inclination is to patch our copy of gnulib to avoid
> replacing stat on Windows.  I'm looking into how to do this.

AFAICT, gnulib/import/m4/stat.m4 does that for MinGW unconditionally:

  case "$host_os" in
    mingw*)
      dnl On this platform, the original stat() returns st_atime, st_mtime,
      dnl st_ctime values that are affected by the time zone.
      REPLACE_STAT=1
      ;;

So the way to avoid the replacement is to modify this test, right?

Thanks.


  reply	other threads:[~2020-06-18 15:04 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 21:10 [PATCH 0/3] Fix gdb's BFD cache Tom Tromey
2020-01-14 21:10 ` [PATCH 2/3] Consistently use BFD's time Tom Tromey
2020-01-14 23:17   ` Christian Biesinger via gdb-patches
2020-01-15 17:51   ` Eli Zaretskii
2020-01-16 20:47     ` Pedro Alves
2020-01-16 21:58       ` Christian Biesinger via gdb-patches
2020-01-16 22:31         ` Pedro Alves
2020-01-17  8:48         ` Eli Zaretskii
2020-01-17 18:32           ` Tom Tromey
2020-01-17 21:03             ` Tom Tromey
2020-01-18 11:07               ` Eli Zaretskii
2020-01-20 15:52                 ` Pedro Alves
2020-01-20 15:53                   ` Pedro Alves
2020-01-20 20:50                   ` Eli Zaretskii
2020-01-20 20:58                     ` Pedro Alves
2020-01-21 15:50                       ` Pedro Alves
2020-01-21 19:38                         ` Eli Zaretskii
2020-01-21 17:56                       ` Eli Zaretskii
2020-01-23 22:05                   ` Tom Tromey
2020-06-19 17:51                   ` Tom Tromey
2020-04-01 20:20       ` Tom Tromey
2020-06-18 14:14     ` Tom Tromey
2020-06-18 15:04       ` Eli Zaretskii [this message]
2020-06-18 16:00         ` Tom Tromey
2020-06-18 17:27           ` Eli Zaretskii
2020-06-18 17:32             ` Pedro Alves
2020-06-18 17:54               ` Eli Zaretskii
2020-06-19 12:02                 ` Pedro Alves
2020-06-19 12:13                   ` Eli Zaretskii
2020-06-19 17:09                   ` Tom Tromey
2020-06-19 20:24                     ` Tom Tromey
2020-06-19 23:05                       ` Pedro Alves
2020-07-21 19:39                         ` Tom Tromey
2020-07-28 19:31                         ` Tom Tromey
2020-08-13 12:15                           ` Tom de Vries
2020-08-14 23:40                             ` Joel Brobecker
2020-08-23 16:09                               ` Joel Brobecker
2020-08-23 23:32                                 ` Pedro Alves
2020-08-24 20:04                                   ` Joel Brobecker
2020-09-02 14:45                                     ` Tom Tromey
2020-09-02 14:59                                       ` Joel Brobecker
2020-06-18 17:57               ` Tom Tromey
2020-01-14 21:10 ` [PATCH 1/3] Avoid hash table corruption in gdb_bfd.c Tom Tromey
2020-01-14 22:26   ` Christian Biesinger via gdb-patches
2020-01-14 22:13 ` [PATCH 3/3] Further simplify gdb BFD caching Tom Tromey
2020-01-23 22:30   ` Tom Tromey
2020-09-02 18:45     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r1ucza8u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tom@tromey.com \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox