Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 557598

Summary: sys-libs/timezone-data does not accept /etc/timezone in the format expected by net-nds/ypserv
Product: Gentoo Linux Reporter: art-gentoo
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED NEEDINFO    
Severity: normal CC: floppym
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description art-gentoo 2015-08-14 17:45:23 UTC
The following should be a valid /etc/timezone file:

:America/New_York

But when upgrading, the following happens:

 * You have an invalid TIMEZONE setting in /etc/timezone
 * Your /etc/localtime has been reset to Factory; enjoy!

... and the already working timezone is blown away.

Having a colon in the timezone is valid and the correct specification for using a file, according to the tzset(3) man page.  Not having the colon is the exception, which means it will first try to parse it as a tz specification, and then default back to using it as a file.

It seems that this would be a quick fix, adding 's/^://' to the sed line in get_TIMEZONE() in the ebuild file.
Comment 1 Mike Gilbert gentoo-dev 2015-08-14 18:00:54 UTC
That description from tzset(3) pertains only to the TZ environment variable, not /etc/timezone. The manual page doesn't mention the latter, and glibc does not use it for anything.

/etc/timezone is only used by the timezone-data ebuild; it is not used anywhere else.

I do not believe there is any documentation that mentions putting a colon in /etc/timezone.
Comment 2 art-gentoo 2015-08-14 18:53:47 UTC
I believe that the very reason /etc/timezone is present in Gentoo is because it was originally copied from a Unix system, where it IS documented.  It would be good to keep it compatible, and allow the tz spec format to be used, like admins of those systems are used to.

It is *also* used by the gentoo package net-dns/ypserv, which expects it to be in the format:
tzspec ypdomainname
e.g.
:America/New_York mynis.domain

Fixing it so it works either way, without clobbering it for those who have it set in a valid Unix compatible format (or who use yp/nis) would not harm anything, only help.
The following change to the ebuild file will extract the filename from either TZ format, Gentoo Special or NIS format, and cause it to not harm those machines where it is in TZ or NIS format, like it does today.

77c77
< 		tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
---
> 		tz=$(sed -e 's/^://;s/[[:space:]#].*//;/^$/d' "${src}")
Comment 3 Mike Gilbert gentoo-dev 2015-08-14 23:57:04 UTC
(In reply to art-gentoo from comment #2)
> I believe that the very reason /etc/timezone is present in Gentoo is because
> it was originally copied from a Unix system, where it IS documented.

[citation needed]

> It is *also* used by the gentoo package net-dns/ypserv, which expects it to
> be in the format:
> tzspec ypdomainname
> e.g.
> :America/New_York mynis.domain

That would indicate that we have two packages using compatible config files. That has been the case for many years.

net-nds/ypserv is currently unmaintained, and I suspect very few people actually use it.

Updating summary and status.
Comment 4 Mike Gilbert gentoo-dev 2015-08-14 23:57:46 UTC
(In reply to Mike Gilbert from comment #3)
> That would indicate that we have two packages using compatible config files.
> That has been the case for many years.

That should say *incompatible* config files.
Comment 5 SpanKY gentoo-dev 2015-08-17 13:14:49 UTC
(In reply to art-gentoo from comment #2)

is is in Gentoo because it's how Debian configures things.  NIS services were never thought about because no one uses these things anymore.

the very thin documentation i can find on the expected format by ypserv is that it is not just a ":<zone>" but "<MET> <nis.domain>".  do you have any links to docs for the format for this file ?  if you're setting it to a TZ-compatible format, then we're not going to support that i don't think ...

also, i don't see either ypserv or ypbind referring to this file in their source (even though ypserv does say "copy this file to /etc/timezone").
Comment 6 SpanKY gentoo-dev 2016-01-02 04:52:17 UTC
art-gentoo: ping ...