commit:     93e2c90293a502cb6402218f2823dc22e0a28093
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 26 23:25:08 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 29 20:49:46 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=93e2c902

emerge-webrsync: mark TZ as exportable in do_latest_snapshot()

As concerns the do_latest_snapshot() function, a recent commit modified
it so as to take advantage of the ability of the printf builtin to act
as a strftime(3) wrapper, rather than be beholden to the non-standard
date(1) utility. As such, it declares 'TZ' as a local variable, with the
intent of ensuring that the UTC timezone is in effect.

However, though printf is indeed a builtin, to assign a new value to the
'TZ' variable is insufficient, as is demonstrated beneath.

# cd /etc
# cp /usr/share/zoneinfo/America/New_York localtime
# TZ=UTC
# printf '%(%F)T\n' 1758758400
2025-09-24
# export TZ
# printf '%(%F)T\n' 1758758400
2025-09-25

Address this issue by setting the 'x' attribute for the 'TZ' variable at
the point of its declaration.

Reported-by: Hank Leininger <hlein <AT> korelogic.com>
Closes: https://bugs.gentoo.org/963423
Fixes: caa8f296a5b3f5bdb8f36321a9334f8ff52d9d30
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/emerge-webrsync | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 8807c8e737..53a3a12715 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -537,7 +537,8 @@ is_snapshot_fresh() {
 
 do_latest_snapshot() {
        local timestamp_{difference,problem} snapshot_{date,unixtime} 
approx_snapshot_time existing_timestamp start_{hour,time}
-       local min_time_diff attempts TZ=UTC
+       local min_time_diff attempts
+       local -x TZ=UTC
 
        einfo "Fetching most recent snapshot ..."
 

Reply via email to