Re: [PATCH] stdio-common: Avoid spurious mtime/ctime-related failure in tst-fseek

Andreas Schwab <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
On Sep 02 2026, Florian Weimer wrote:

> diff --git a/stdio-common/tst-fseek.c b/stdio-common/tst-fseek.c
> index 086ede5967..64f1e0a057 100644
> --- a/stdio-common/tst-fseek.c
> +++ b/stdio-common/tst-fseek.c
> @@ -345,12 +345,14 @@ do_test (void)
>  	      printf ("%d: st_mtime not updated\n", __LINE__);
>  	      result = 1;
>  	    }
> -	  if (st1.st_ctime >= st2.st_ctime)
> +	  if (st1.st_ctime >= st2.st_ctime
> +	      && st1.st_ctim.tv_nsec == st2.st_ctim.tv_nsec)
>  	    {
>  	      printf ("%d: st_ctime not changed\n", __LINE__);
>  	      result = 1;
>  	    }
> -	  if (st1.st_mtime >= st2.st_mtime)
> +	  if (st1.st_mtime >= st2.st_mtime
> +	      && st1.st_mtim.tv_nsec == st2.st_mtim.tv_nsec)
>  	    {
>  	      printf ("%d: st_mtime not changed\n", __LINE__);
>  	      result = 1;

What about the other two conditions before those?  It's also strange to
use >= instead of ==, as if the test tries to handle time going
backwards in some way.

-- 
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.