GNU bug report logs - #51228
Incorrect timezone in unified diff on Solaris?

Previous Next

Package: diffutils;

Reported by: Vladimir Marek <Vladimir.Marek <at> oracle.com>

Date: Fri, 15 Oct 2021 13:57:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51228 in the body.
You can then email your comments to 51228 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#51228; Package diffutils. (Fri, 15 Oct 2021 13:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vladimir Marek <Vladimir.Marek <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Fri, 15 Oct 2021 13:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vladimir Marek <Vladimir.Marek <at> oracle.com>
To: bug-diffutils <at> gnu.org
Subject: Incorrect timezone in unified diff on Solaris?
Date: Fri, 15 Oct 2021 15:55:17 +0200
[Message part 1 (text/plain, inline)]
Hi,

I believe that this is bug in diffutils, but I am not entirely sure. The
problem manifested itself while testing patchutils on Solaris. One of
the tests was failing. Upon closer inspection the filterdiff (aka
lsdiff) decides whether a give chunk is creating (or deleting) a file
based on timestamp the chunk is having. It compares whether the timezone
recorded equals to current timezone.

https://github.com/twaugh/patchutils/blob/master/src/filterdiff.c#L156

On Solaris patchutils correctly detect that there is no
struct tm ->  tm_gmtoff (HAVE_TM_GMTOFF). On line 1417 of nstrftime.c

 1415 #if HAVE_TM_GMTOFF
 1416             diff = tp->tm_gmtoff;
 1417 #else
 1418             if (!tz)
 1419               diff = 0;
 1420             else

And since there is zero tz specified in context.c

if (! (tm && nstrftime (buf, sizeof buf, time_format, tm, 0, nsec)))
                                                         ^^^

The resulting chunk has zero timezone offset (on Solaris). Like here:

$ TZ=EST+5 gdiff -urN dir.orig dir
diff -urN dir.orig/a dir/a
--- dir.orig/a  1969-12-31 19:00:00.000000000 +0000  <------ this file is missing
+++ dir/a       2021-10-14 12:24:20.785102347 +0000

On Linux and after my fix on Solaris the result is

--- dir.orig/a  1969-12-31 19:00:00.000000000 -0500

I am not entirely sure where is nstrftime.c coming from, so I'm
reporting the issue here. I am also attaching patch I plan to use on
Solaris. The patch and additional test works for me on diffutils 3.8 on
both Linux and Solaris.

Thanks for diffutils, I believe it's the most important tool for release
engineer :)

Cheers
-- 
	Vlad
[timezone.patch (text/plain, attachment)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sat, 16 Oct 2021 02:06:02 GMT) Full text and rfc822 format available.

Notification sent to Vladimir Marek <Vladimir.Marek <at> oracle.com>:
bug acknowledged by developer. (Sat, 16 Oct 2021 02:06:02 GMT) Full text and rfc822 format available.

Message #10 received at 51228-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Vladimir Marek <Vladimir.Marek <at> oracle.com>
Cc: 51228-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#51228: Incorrect timezone in unified diff on
 Solaris?
Date: Fri, 15 Oct 2021 19:05:36 -0700
[Message part 1 (text/plain, inline)]
On 10/15/21 6:55 AM, Vladimir Marek wrote:

> I am not entirely sure where is nstrftime.c coming from, so I'm
> reporting the issue here.

Thanks for reporting it. Although nstrftime.c comes from Gnulib, this is 
a diffutils bug: the 0 diffutils passes to nstrftime stands for 
Universal Time (UT), whereas local time is wanted. This bug is not 
triggered on GNU/Linux or the BSDs, which have tm_gmtoff in their 
struct tm.

I installed the attached patch into diffutils. Please give it a try, as 
the patch you sent mishandles the case when today's UT offset differs 
from the UT offset in effect when the file was last modified (e.g., due 
to a daylight-saving change).
[0001-diff-fix-timezone-bug-on-Solaris.patch (text/x-patch, attachment)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#51228; Package diffutils. (Mon, 18 Oct 2021 14:29:01 GMT) Full text and rfc822 format available.

Message #13 received at 51228 <at> debbugs.gnu.org (full text, mbox):

From: Vladimir Marek <Vladimir.Marek <at> oracle.com>
To: 51228 <at> debbugs.gnu.org
Subject: Re: [External] : bug#51228: closed (Re: [bug-diffutils] bug#51228:
 Incorrect timezone in unified diff on Solaris?)
Date: Mon, 18 Oct 2021 16:28:10 +0200
[...]

> I installed the attached patch into diffutils. Please give it a try, as the
> patch you sent mishandles the case when today's UT offset differs from the
> UT offset in effect when the file was last modified (e.g., due to a
> daylight-saving change).

Your patch works fine for me, I'll gladly use it instead of my change.

Thank you
-- 
	Vlad




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 16 Nov 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.