Package: devscripts

Version: v2.23.7

Severity: important

Tags: patch


As the man page, user can set DEBCHANGE_TZ in /etc/devscripts.conf
and ~/.devscripts to change the timezone of changelog entries, and
also can change it by the environment variable TZ.

https://manpages.debian.org/stretch/devscripts/dch.1.en.html

But none of them is successful. The root cause is $DATE is always
set as localtime(). The timezone is passed via $opt_tz, so adding
judgement to check whether $opt_zt is set.

Test
a) Add DEBCHANGE_TZ in /etc/devscripts.conf
dch -i
b) TZ="xxxxxxxx" dch -i
From 82065bdbd2ae5bd696d0554f0152540f1a6e2f64 Mon Sep 17 00:00:00 2001
From: Yue Tao <yue....@windriver.com>
Date: Tue, 9 Jan 2024 21:44:23 -0800
Subject: [PATCH] debchange: can't set timezone for changelog entries

As the man page, user can set DEBCHANGE_TZ in /etc/devscripts.conf
and ~/.devscripts to change the timezone of changelog entries, and
also can change it by the environment variable TZ.

https://manpages.debian.org/stretch/devscripts/dch.1.en.html

But none of them is successful. The root cause is $DATE is always
set as localtime(). The timezone is passed via $opt_tz, so adding
judgement to check whether $opt_zt is set.

Test
a) Add DEBCHANGE_TZ in /etc/devscripts.conf
dch -i
b) TZ="xxxxxxxx" dch -i

Signed-off-by: Yue Tao <yue....@windriver.com>
---
 scripts/debchange.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 73501c33..b91c5776 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -1043,7 +1043,11 @@ if (@ARGV and !$TEXT) {
 my $DATE;
 {
     local $ENV{TZ} = $opt_tz if $opt_tz;
-    $DATE = strftime "%a, %d %b %Y %T %z", localtime();
+    if ($opt_tz) {
+        $DATE = $opt_tz;
+    } else {
+        $DATE = strftime "%a, %d %b %Y %T %z", localtime();
+    }
 }
 
 if ($opt_news && !$opt_i && !$opt_a) {
-- 
2.42.0

Reply via email to