Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 526956 - sys-libs/timezone-data: wrong TZDIR in compiled programs causes zdump not to find zoneinfo rules
Summary: sys-libs/timezone-data: wrong TZDIR in compiled programs causes zdump not to ...
Status: RESOLVED DUPLICATE of bug 526790
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-26 17:55 UTC by Kevin Pyle
Modified: 2014-10-26 23:00 UTC (History)
0 users

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 Kevin Pyle 2014-10-26 17:55:43 UTC
Package sys-libs/timezone-data provides /usr/sbin/zdump, which shows when daylight saving time starts and ends in different timezones.  On Gentoo, zdump ignores the installed zoneinfo files because the upstream build system makes it difficult to reset TZDIR properly, so zdump uses the upstream default for the zoneinfo directory, rather than the value used in Gentoo.  Proposed fix at the end.  Analysis follows.

If TZDIR is unset during compilation, then tzfile.h will set a default:

#define TZDIR	"/usr/local/etc/zoneinfo" /* Time zone object file directory */

This default is wrong for Gentoo, and should be overridden by a preprocessor argument of -DTZDIR="$(TZDIR)", which would use the value from the Makefile.  Gentoo patches the Makefile to have the correct value, but this patch is ineffective.  Upstream passes -DTZDIR="$(TZDIR)" through overriding CC:

cc=		cc
CC=		$(cc) -DTZDIR=\"$(TZDIR)\"

Gentoo includes a patch to change this:

-cc=            cc
-CC=            $(cc) -DTZDIR=\"$(TZDIR)\"
+CC+=           -DTZDIR=\"$(TZDIR)\"
+ifeq ($(NLS),1)
+CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
+endif

Unfortunately, Gentoo also sets CC="$(tc-getCC)" on the make command line.  According to the GNU make documentation, and confirmed by reading the build logs, if a variable is set on the command line, *all* attempts to modify it in the Makefile (other than those which use the override keyword) are ignored.  Thus, the Gentoo patch could omit the CC+= lines and the effect would be the same.

I propose changing the ebuild to define cc="$(tc-getCC)" instead of CC="$(tc-getCC)", then changing the patch to leave the definition of CC and only add the NLS-related lines, resulting in:

CC=            $(cc) -DTZDIR=\"$(TZDIR)\"
ifeq ($(NLS),1)
CC+= -DHAVE_GETTEXT=1 -DTZ_DOMAIN=\"libc\"
endif
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2014-10-26 23:00:18 UTC

*** This bug has been marked as a duplicate of bug 526790 ***