Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 623962 - sys-libs/musl should depend on sys-libs/timezone-data
Summary: sys-libs/musl should depend on sys-libs/timezone-data
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL: http://wiki.musl-libc.org/wiki/Enviro...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-06 09:03 UTC by Patrick McMunn
Modified: 2019-10-20 14:56 UTC (History)
5 users (show)

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


Attachments
Set the TZ variable in the file /etc/env.d/00musl (00musl,1.86 KB, text/plain)
2017-07-11 20:11 UTC, Kevin Vigouroux
Details
The previous configuration file has errors! (00musl,2.18 KB, text/plain)
2017-07-12 06:34 UTC, Kevin Vigouroux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick McMunn 2017-07-06 09:03:14 UTC
musl uses the TZ environment variable to know what timezone to apply to the system, and it searches /usr/share/zoneinfo, /share/zoneinfo, and /etc/zoneinfo to find the appropriate timezone data file. I downloaded an installed an amd_64 vanilla musl image, and it did not have timezone data preinstalled or otherwise marked as a necessity (say in the @system set), but it should.

As a result, the user needs to be notified about the proper way to set the environment variable. musl installs /etc/env.d/00musl but this only sets the LDPATH.

Reproducible: Always
Comment 1 Anthony Basile gentoo-dev 2017-07-06 16:02:16 UTC
(In reply to Patrick McMunn from comment #0)
> musl uses the TZ environment variable to know what timezone to apply to the
> system, and it searches /usr/share/zoneinfo, /share/zoneinfo, and
> /etc/zoneinfo to find the appropriate timezone data file. I downloaded an
> installed an amd_64 vanilla musl image, and it did not have timezone data
> preinstalled or otherwise marked as a necessity (say in the @system set),
> but it should.
> 
> As a result, the user needs to be notified about the proper way to set the
> environment variable. musl installs /etc/env.d/00musl but this only sets the
> LDPATH.
> 
> Reproducible: Always

Is it sufficient to just include sys-libs/timezone-data to fix the issue?
Comment 2 Patrick McMunn 2017-07-06 20:32:42 UTC
I think so. It's essentially a runtime dependency just like with glibc. Though I did have an afterthought. I don't do dev work, but I know musl is largely used in embedded applications. I don't know if such developers, who might be using Gentoo, would rather not be forced to pull in timezone-data for their embedded applications. But it should at least be pulled in for desktop installations. So I figured I'd at least throw that out there for consideration. I suppose it could be handled by a USE flag that would be enabled by default and could be disabled by people that knew they didn't want it.

There should probably also be a message displayed to the user recommending they add a Posix-compliant timezone setting line like

TZ="CST6CDT"

to /etc/env.d/00musl for a system-wide setting or

TZ='CST6CDT'; export TZ

to ~/.profile for a per-user setting (though I don't know why different users would ever need different timezones, but that's what's recommended by tzselect).

Though honestly I don't know how useful that message would really be. Most people using a musl system will have installed from a stage3, like I did, and have it already installed, so they may never see that message until they upgrade musl. But right now, there's nothing in the Gentoo handbook or wiki about handling timezones (or anything else, for that matter) when using musl as opposed to glibc. So maybe the better option, instead of displaying a message, is to just update the handbook and wiki to cover musl.
Comment 3 Kevin Vigouroux 2017-07-07 09:07:43 UTC
(In reply to Anthony Basile from comment #1)
> ...
> Is it sufficient to just include sys-libs/timezone-data to fix the issue?

musl aims to be POSIX compliant so the POSIX convention should prevail over the sys-libs/timezone-data package. In other words, the package should not be integrated into the stage3 archive.

(In reply to Patrick McMunn from comment #2)
> ...
> Though honestly I don't know how useful that message would really be. Most
> people using a musl system will have installed from a stage3, like I did,
> and have it already installed, so they may never see that message until they
> upgrade musl. But right now, there's nothing in the Gentoo handbook or wiki
> about handling timezones (or anything else, for that matter) when using musl
> as opposed to glibc. So maybe the better option, instead of displaying a
> message, is to just update the handbook and wiki to cover musl.

In fact, it would be good to write a wiki article about how to use a musl-based system. The handbook covers a standard installation and should not be overloaded by optionnal information (& unstable/experimental). By default, we can explain how to configure the time zone on the project page.

References:

* https://wiki.gentoo.org/wiki/Project:Hardened_musl

* https://wiki.gentoo.org/wiki/Gentoo_Wiki:Requested_Articles#Core_system

* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
Comment 4 Anthony Basile gentoo-dev 2017-07-07 11:27:24 UTC
(In reply to Kevin Vigouroux from comment #3)
> (In reply to Anthony Basile from comment #1)
> > ...
> > Is it sufficient to just include sys-libs/timezone-data to fix the issue?
> 
> musl aims to be POSIX compliant so the POSIX convention should prevail over
> the sys-libs/timezone-data package. In other words, the package should not
> be integrated into the stage3 archive.

I don't want to bloat the stage3 so I won't be adding sys-libs/timezone-data.  What's wrong with just adding TZ="GMT" to /etc/env.d/00musl ?

> 
> (In reply to Patrick McMunn from comment #2)
> > ...
> > Though honestly I don't know how useful that message would really be. Most
> > people using a musl system will have installed from a stage3, like I did,
> > and have it already installed, so they may never see that message until they
> > upgrade musl. But right now, there's nothing in the Gentoo handbook or wiki
> > about handling timezones (or anything else, for that matter) when using musl
> > as opposed to glibc. So maybe the better option, instead of displaying a
> > message, is to just update the handbook and wiki to cover musl.
> 
> In fact, it would be good to write a wiki article about how to use a
> musl-based system. The handbook covers a standard installation and should
> not be overloaded by optionnal information (& unstable/experimental). By
> default, we can explain how to configure the time zone on the project page.
> 

I don't have the energy to do that, but would welcome others to contribute.
Comment 5 Patrick McMunn 2017-07-07 14:14:07 UTC
I was under the impression, from reading the musl docs, that setting the TZ environment variable just caused musl to read the appropriate entry from timezone data -- hence the request for including it. I read that musl only doesn't have to read a timezone-data file if a long entry like

TZ="CET-1CEST,M3.5.0,M10.5.0/3"

is set (source: https://github.com/sabotage-linux/sabotage/wiki/timezones ).
Comment 6 Kevin Vigouroux 2017-07-07 15:11:18 UTC
(In reply to Anthony Basile from comment #4)
> ...
> I don't want to bloat the stage3 so I won't be adding sys-libs/timezone-data.
> What's wrong with just adding TZ="GMT" to /etc/env.d/00musl ?

It seems good (note that in the example, the offset should be specified)!

> I don't have the energy to do that, but would welcome others to contribute.
> ...

Well, you could add an empty TZ variable (hidden, commented) and explain 
how to configure this one in the file /etc/env.d/00musl.

(In reply to Patrick McMunn from comment #2)
> ...
> There should probably also be a message displayed to the user recommending 
> they add a Posix-compliant timezone (...)
> ...

The TZ variable overrides the default timezone. The clock seems to be "set" by the system firmware either in local time or in UTC. If the clock indicates a time in UTC then the change of the time zone is not absolutely necessary.

News will be useful because the Handbook advices to read the news 
using 'eselect news list' during the installation of Gentoo.
Comment 7 Anthony Basile gentoo-dev 2017-07-09 09:18:03 UTC
Does someone want to suggest a patch.
Comment 8 Kevin Vigouroux 2017-07-11 20:11:52 UTC
Created attachment 483332 [details]
Set the TZ variable in the file /etc/env.d/00musl
Comment 9 Kevin Vigouroux 2017-07-11 20:15:04 UTC
I made some comments so that the user can initialize the variable TZ.

Feel free to comment or modify the file!
Comment 10 Kevin Vigouroux 2017-07-12 06:34:15 UTC
Created attachment 483334 [details]
The previous configuration file has errors!

* Fixed mistakes: confusion between ahead and behind, incomplete format.

* Added a note about the sys-libs/timezone-data package.