[Bug 2030684] Re: tzname[1] empty after tzset() with env TZ="UTC"
Benjamin Drung
2030684 at bugs.launchpad.net
Tue Aug 8 12:09:15 UTC 2023
Change prepared in https://git.launchpad.net/~ubuntu-core-
dev/ubuntu/+source/tzdata/log/
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2030684
Title:
tzname[1] empty after tzset() with env TZ="UTC"
Status in php8.2 package in Ubuntu:
New
Status in postgresql-15 package in Ubuntu:
New
Status in systemd package in Ubuntu:
New
Status in tzdata package in Ubuntu:
New
Status in tzdata package in Debian:
Unknown
Bug description:
The following program prints different output when run with tzdata
2023c-7ubuntu1 from mantic, versus tzdata 2023c-8ubuntu1 from mantic-
proposed:
root at mantic:~# cat bug.c
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(void) {
int r;
r = setenv("TZ", ":UTC", 1);
if (r < 0) {
printf("Failed to set TZ env var: %s\n", strerror(errno));
return 1;
}
tzset();
printf("timezone = %lu, daylight = %d\n", timezone, daylight);
printf("tzname[0] = %s, tzname[1] = %s\n", tzname[0], tzname[1]);
}
root at mantic:~# gcc bug.c
root at mantic:~# ./a.out
timezone = 0, daylight = 0
tzname[0] = UTC, tzname[1] = UTC
root at mantic:~# apt-cache policy tzdata
tzdata:
Installed: 2023c-7ubuntu1
Candidate: 2023c-7ubuntu1
Version table:
*** 2023c-7ubuntu1 500
500 http://archive.ubuntu.com/ubuntu mantic/main amd64 Packages
100 /var/lib/dpkg/status
If I install tzdata from mantic-proposed, I get different output:
root at mantic:~# vi /etc/apt/sources.list
root at mantic:~# apt update && apt install tzdata
Hit:1 http://archive.ubuntu.com/ubuntu mantic InRelease
Hit:2 http://security.ubuntu.com/ubuntu mantic-security InRelease
Get:3 http://archive.ubuntu.com/ubuntu mantic-proposed InRelease [118 kB]
Hit:4 http://archive.ubuntu.com/ubuntu mantic-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu mantic-backports InRelease
Get:6 http://archive.ubuntu.com/ubuntu mantic-proposed/main amd64 Packages [35.9 kB]
Get:7 http://archive.ubuntu.com/ubuntu mantic-proposed/main Translation-en [14.8 kB]
Get:8 http://archive.ubuntu.com/ubuntu mantic-proposed/main amd64 DEP-11 Metadata [2376 B]
Get:9 http://archive.ubuntu.com/ubuntu mantic-proposed/main amd64 c-n-f Metadata [1004 B]
Get:10 http://archive.ubuntu.com/ubuntu mantic-proposed/restricted amd64 Packages [15.9 kB]
Get:11 http://archive.ubuntu.com/ubuntu mantic-proposed/restricted Translation-en [3564 B]
Get:12 http://archive.ubuntu.com/ubuntu mantic-proposed/restricted amd64 c-n-f Metadata [336 B]
Fetched 192 kB in 1s (324 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
72 packages can be upgraded. Run 'apt list --upgradable' to see them.
root at mantic:~# apt install tzdata=2023c-8ubuntu1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libefiboot1 libefivar1
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
tzdata
1 upgraded, 0 newly installed, 0 to remove and 72 not upgraded.
Need to get 269 kB of archives.
After this operation, 142 kB disk space will be freed.
Get:1 http://archive.ubuntu.com/ubuntu mantic-proposed/main amd64 tzdata all 2023c-8ubuntu1 [269 kB]
Fetched 269 kB in 0s (867 kB/s)
Preconfiguring packages ...
(Reading database ... 39935 files and directories currently installed.)
Preparing to unpack .../tzdata_2023c-8ubuntu1_all.deb ...
Unpacking tzdata (2023c-8ubuntu1) over (2023c-7ubuntu1) ...
Setting up tzdata (2023c-8ubuntu1) ...
Current default time zone: 'Etc/UTC'
Local time is now: Mon Aug 7 21:18:35 UTC 2023.
Universal Time is now: Mon Aug 7 21:18:35 UTC 2023.
Run 'dpkg-reconfigure tzdata' if you wish to change it.
Scanning processes...
Scanning candidates...
Restarting services...
Service restarts being deferred:
systemctl restart systemd-logind.service
systemctl restart unattended-upgrades.service
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this
host.
root at mantic:~# ./a.out
timezone = 0, daylight = 0
tzname[0] = UTC, tzname[1] =
root at mantic:~# apt-cache policy tzdata-legacy
tzdata-legacy:
Installed: (none)
Candidate: 2023c-7ubuntu1
Version table:
2023c-8ubuntu1 100
100 http://archive.ubuntu.com/ubuntu mantic-proposed/main amd64 Packages
2023c-7ubuntu1 500
500 http://archive.ubuntu.com/ubuntu mantic/main amd64 Packages
In particular, note that tzname[1] (the name of the daylight zone) is
empty, whereas it previously printed "UTC".
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/php8.2/+bug/2030684/+subscriptions
More information about the foundations-bugs
mailing list