Util-Linux package development
 help / color / mirror / Atom feed
From: J William Piggott <elseifthen@gmx.com>
To: Karel Zak <kzak@redhat.com>, Isaac Dunham <ibid.ag@gmail.com>
Cc: util-linux@vger.kernel.org
Subject: [PATCH 1/1] hwclock: Remove TZUTC
Date: Thu, 23 Apr 2015 19:53:58 -0400	[thread overview]
Message-ID: <55398616.5020004@gmx.com> (raw)
In-Reply-To: <55398435.4090504@gmx.com>


commit d53f8ecfbf036eddb2aef737dc0973a613d80ced
introduced the TZUTC environment variable to
facilitate use of the zoneinfo 'right' database.
This was incorrect. Either the TZDIR environment
variable should be used or a system-wide
configuration for the 'right' database should be
used.

See hwclock(8) POSIX vs 'RIGHT' for more details.

TZUTC was undocumented and should be safe to remove.

The commit also caused a regression when using
musl libc, because when TZUTC is unset getenv()
returns a NULL pointer.
Reported-by: Isaac Dunham <ibid.ag@gmail.com>

Signed-off-by: J William Piggott <elseifthen@gmx.com>
---
 sys-utils/hwclock.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index e1e5816..f4784a1 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -400,15 +400,8 @@ mktime_tz(struct tm tm, const bool universal,
 	 */
 	zone = getenv("TZ");	/* remember original time zone */
 	if (universal) {
-		/* Set timezone to UTC as defined by the environment
-		 * variable TZUTC.  TZUTC undefined gives the default UTC
-		 * zonefile which usually does not take into account leap
-		 * seconds.  Define TZUTC to select your UTC zonefile which
-		 * does include leap seconds.  For example, with recent GNU
-		 * libc's:
-		 *    TZUTC=:/usr/share/zoneinfo/right/UTC
-		 */
-		setenv("TZ", getenv("TZUTC"), TRUE);
+		/* Set timezone to UTC */
+		setenv("TZ", "", TRUE);
 		/*
 		 * Note: tzset() gets called implicitly by the time code,
 		 * but only the first time. When changing the environment

  reply	other threads:[~2015-04-23 23:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  4:49 [PATCH] hwclock: avoid UB if TZUTC is unset; include sys/time.h for timeval Isaac Dunham
2015-04-23 23:45 ` [PATCH 0/1] hwclock: Remove TZUTC J William Piggott
2015-04-23 23:53   ` J William Piggott [this message]
2015-04-27  8:07     ` [PATCH 1/1] " Karel Zak
2015-04-24  4:26   ` [PATCH 0/1] " Isaac Dunham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55398616.5020004@gmx.com \
    --to=elseifthen@gmx.com \
    --cc=ibid.ag@gmail.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox