bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] gitlog-to-changelog: Make output reproducible.


From: Simon Josefsson
Subject: [PATCH] gitlog-to-changelog: Make output reproducible.
Date: Fri, 12 Apr 2024 17:33:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi

I ran into a reproducability problem in gitlog-to-changelog, and noticed
Guix people had also ran into this and worked around it outside of
gitlog-to-changelog:

https://issues.guix.gnu.org/70169/#21

However I don't think it makes sense for ChangeLog dates to depend on
the timezone under any circumstance.

One nit may be that I'm not certain the 'git log' command is time zone
dependent, but at least I could reproduce timezone problems before
applying this patch but not after applying it, so I believe the 'git
log' command already was not time zone dependent.  Test like this:

jas@kaka:~/src/gnulib$ build-aux/gitlog-to-changelog > foo
jas@kaka:~/src/gnulib$ TZ=UTC0 build-aux/gitlog-to-changelog > bar
jas@kaka:~/src/gnulib$ diff -ur foo bar

I have committed this.

/Simon
From dfb71172a46ef41f8cf8ab7ca529c1dd3097a41d Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon@josefsson.org>
Date: Fri, 12 Apr 2024 17:25:16 +0200
Subject: [PATCH] gitlog-to-changelog: Make output reproducible.

* build-aux/gitlog-to-changelog: Use gmtime instead of localtime.
---
 ChangeLog                     | 5 +++++
 build-aux/gitlog-to-changelog | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cdbb53ff8a..b20f69b06b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-04-12  Simon Josefsson  <simon@josefsson.org>
+
+       gitlog-to-changelog: Make output reproducible.
+       * build-aux/gitlog-to-changelog: Use gmtime instead of localtime.
+
 2024-04-12  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool.py: Fix parsing of gl_LGPL in gnulib-cache.m4.
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 16a9405a7c..e06106490c 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -35,7 +35,7 @@
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
-my $VERSION = '2023-06-24 21:59'; # UTC
+my $VERSION = '2024-04-12 15:23'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -360,7 +360,7 @@ sub git_dir_option($)
                   ? '  (tiny change)' : '');
 
       my $date_line = sprintf "%s  %s$tiny\n",
-        strftime ("%Y-%m-%d", localtime ($1)), $2;
+        strftime ("%Y-%m-%d", gmtime ($1)), $2;
 
       my @coauthors = grep /^Co-authored-by:.*$/, @line;
       # Omit meta-data lines we've already interpreted.
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature


reply via email to

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