From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7514 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: Re: setenv if value=NULL, what say standard? Bug? Date: Thu, 23 Apr 2015 21:11:11 -0700 Message-ID: <20150424041110.GA1841@newbook> References: <553837F1.5080808@safe.ca> <55383E43.8010505@skarnet.org> <55384A61.5020001@safe.ca> <20150423021507.GG6817@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1429848683 22412 80.91.229.3 (24 Apr 2015 04:11:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Apr 2015 04:11:23 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7527-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 24 06:11:23 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YlUxW-0002Zk-4k for gllmg-musl@m.gmane.org; Fri, 24 Apr 2015 06:11:22 +0200 Original-Received: (qmail 32255 invoked by uid 550); 24 Apr 2015 04:11:20 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32234 invoked from network); 24 Apr 2015 04:11:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=6tObKEsUAlArQfE3O8O6qzZvskvRZ3F/l8wtpbSfUfw=; b=NZMeUpvOVOjSTMlFesT2zB+YYRQJ4cqTDDDN8lRx66Obzbdk0tSYp0yt+1+EFElMAE wVdOVk0oRStSzR+iQB6dlPAnpCG86WWdHxmh5vTcfDmHY8OQTKn1H8Id33tWuKQBzJU2 LKlgh+lDl3QtMRXmqr+1MhN+0PT7pMktb6ve8pxmSI3jPmi4eYo1N31B5oTYSeAJQ1t3 SS0aUJzjG3B1OL2EyqwHMFvUkVBD1EsroCpD9BZqr/ZgYsG3hG36ozG2Pypn3iibEHFh MZKLg6gmiO+yuDX3s1K+RxYEfMI2RG4o2rWRS01/NGT7VQen1bcSqQjtUgwJc07p8Yh9 4plg== X-Received: by 10.70.35.201 with SMTP id k9mr2446213pdj.128.1429848667776; Thu, 23 Apr 2015 21:11:07 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20150423021507.GG6817@brightrain.aerifal.cx> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:7514 Archived-At: 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