emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51228: closed (Incorrect timezone in unified diff on Solaris?)


From: GNU bug Tracking System
Subject: bug#51228: closed (Incorrect timezone in unified diff on Solaris?)
Date: Sat, 16 Oct 2021 02:06:02 +0000

Your message dated Fri, 15 Oct 2021 19:05:36 -0700
with message-id <c4c165b3-d748-ee43-4ac6-a0c6a3f9c785@cs.ucla.edu>
and subject line Re: [bug-diffutils] bug#51228: Incorrect timezone in unified 
diff on Solaris?
has caused the debbugs.gnu.org bug report #51228,
regarding Incorrect timezone in unified diff on Solaris?
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
51228: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=51228
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Incorrect timezone in unified diff on Solaris? Date: Fri, 15 Oct 2021 15:55:17 +0200
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

Attachment: timezone.patch
Description: Text document


--- End Message ---
--- Begin Message --- Subject: Re: [bug-diffutils] bug#51228: Incorrect timezone in unified diff on Solaris? Date: Fri, 15 Oct 2021 19:05:36 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0
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).

Attachment: 0001-diff-fix-timezone-bug-on-Solaris.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]