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
(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?
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.
(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
(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.
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 ).
(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.
Does someone want to suggest a patch.
Created attachment 483332 [details] Set the TZ variable in the file /etc/env.d/00musl
I made some comments so that the user can initialize the variable TZ. Feel free to comment or modify the file!
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.
*** Bug 881655 has been marked as a duplicate of this bug. ***