[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-diffutils] bug#51228: Incorrect timezone in unified diff on Solaris
From: |
Vladimir Marek |
Subject: |
[bug-diffutils] bug#51228: 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
timezone.patch
Description: Text document
- [bug-diffutils] bug#51228: Incorrect timezone in unified diff on Solaris?,
Vladimir Marek <=