Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 570388 - sys-libs/timezone-data: pkg_config() silently returns when /etc/timezone is empty
Summary: sys-libs/timezone-data: pkg_config() silently returns when /etc/timezone is e...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-31 12:43 UTC by Tobias Heinlein (RETIRED)
Modified: 2016-01-02 05:29 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Heinlein (RETIRED) gentoo-dev 2015-12-31 12:43:41 UTC
A friend of mine and I were just wondering why emerge --config timezone-data didn't update his /etc/localtime. It didn't print any errors, so we were assuming it ran correctly.

The issue was that his /etc/timezone was existing, but accidentally empty. The code path taken is this:

get_TIMEZONE() {
  ...
  [[ -z ${tz} ]] && return 1 || echo "${tz}"
}

...

tz=$(get_TIMEZONE) || return 0

=> Silently returns.

I assume checking for an empty /etc/timezone file was on purpose, but this behaviour was not intended. I suppose a warning would be appropriate. In fact, there are a few checks directly after that which aren't reached in this case however.

Can't we just remove the [[ -z ${tz} ]] check?
Comment 1 SpanKY gentoo-dev 2015-12-31 17:21:32 UTC
it's this way on purpose.  a file that exists but is empty is the same as having a file where the var is set to nothing.  e.g. the old code had:
/etc/conf.d/clock:
TIMEZONE=""
https://sources.gentoo.org/sys-libs/timezone-data/timezone-data-2007c.ebuild?r1=1.9&r2=1.10

hence we also support setting /etc/timezone to an empty file to disable the logic.  this is an explicit knob for the admin.

since it's explicitly supported, a warning is inappropriate: the system state is not in a bad state.  it also would lead to pkg_postinst elog spam which we explicitly avoid.

we could add an `einfo` in there to say it's returning as that would be swallowed by the PM during normal runs.
Comment 2 Tobias Heinlein (RETIRED) gentoo-dev 2016-01-01 21:01:17 UTC
(In reply to SpanKY from comment #1)
> [..]
> hence we also support setting /etc/timezone to an empty file to disable the
> logic.  this is an explicit knob for the admin.

Ok, sounds reasonable.

> we could add an `einfo` in there to say it's returning as that would be
> swallowed by the PM during normal runs.

Ok, good. Thanks.
Comment 3 SpanKY gentoo-dev 2016-01-02 05:29:44 UTC
this should satisfy your request:
http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2178d2c8957b99e73d120472e06d751a5e80ea1d