mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac Dunham <ibid.ag@gmail.com>
To: musl@lists.openwall.com
Subject: Re: setenv if value=NULL, what say standard? Bug?
Date: Thu, 23 Apr 2015 21:11:11 -0700	[thread overview]
Message-ID: <20150424041110.GA1841@newbook> (raw)
In-Reply-To: <20150423021507.GG6817@brightrain.aerifal.cx>

On Wed, Apr 22, 2015 at 10:15:07PM -0400, Rich Felker wrote:
> On Wed, Apr 22, 2015 at 09:26:57PM -0400, Jean-Marc Pigeon wrote:
> > The application is not careful enough, but not incorrect as such.
> 
> It's definitely incorrect. It's doing something that invokes undefined
> behavior.
> 
> > Note: we may have tons of applications with the same problem.
> > if we keep musl setenv like that, musl will be seen as quite unreliable.

I sent a patch that checks that getenv("TZUTC") is not null before using
it to the util-linux, and one of the developers proposed a different fix:
get rid of TZUTC usage altogether.

Apparently, this was introduced in 2013 by someone who wanted to use
the "right" (zoneinfo-leaps) timezone database, but didn't understand
the correct way to set it up. It happens to have been a drive-by patch
that had no updates for the public documentation, for what that's worth.

Instead of setting TZUTC (presumably to ":right/UTC" or equivalent),
the *proper* approach to using the "right" database is to set TZDIR
to /usr/share/zoneinfo/right or /usr/share/zoneinfo-leaps (depending
on your distro's packaging of tzdata), or to copy all the files into
/usr/share/zoneinfo/.
According to hwclock(8), the tzdata maintainers moved
/usr/share/zoneinfo/right to /usr/share/zoneinfo-leaps in order to
discourage people from using TZ=:right/...; this format makes it
inconvenient to mix zones on a single machine, since you cannot mix
and match "right" and "posix" without getting unexpeccted results.

tl;dr: it's not old code but a recent (2-year old) undocumented addition,
apparently done without checking the proper way to set up tzdata with
leap seconds. It is thus redundant with TZDIR, besides relying on a use
of TZ that is conceptually broken.
If someone throws together quick hacks without reading the documentation,
breakage may be expected even if they test it, since there's no guarantee
that everything everywhere will work like the few test systems one person
has for an indefinate length of time.

Thanks,
Isaac Dunham


  parent reply	other threads:[~2015-04-24  4:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  0:08 Jean-Marc Pigeon
2015-04-23  0:35 ` Laurent Bercot
2015-04-23  1:26   ` Jean-Marc Pigeon
2015-04-23  2:15     ` Rich Felker
2015-04-23  4:24       ` Jean-Marc Pigeon
2015-04-23  5:08         ` Raphael Cohn
2015-04-23 12:29           ` Jean-Marc Pigeon
2015-04-23  9:23         ` Laurent Bercot
2015-04-23  9:52           ` Raphael Cohn
2015-04-23 10:47             ` Laurent Bercot
2015-04-23 10:10         ` Rich Felker
2015-04-23 12:58           ` Jean-Marc Pigeon
2015-04-23 13:22             ` Szabolcs Nagy
2015-04-23 13:58               ` Jean-Marc Pigeon
2015-04-23 14:26                 ` Szabolcs Nagy
2015-04-23  8:05       ` Jens Gustedt
2015-04-23  9:55         ` Rich Felker
2015-04-24  4:11       ` Isaac Dunham [this message]
2015-04-23  5:52   ` 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=20150424041110.GA1841@newbook \
    --to=ibid.ag@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).