Skip to content

Support obtaining the system timezone on old Debian-based distributions #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dkhalanskyjb opened this issue Sep 2, 2024 · 6 comments
Closed
Assignees
Milestone

Comments

@dkhalanskyjb
Copy link
Collaborator

From https://wiki.debian.org/TimeZoneChanges:

In Debian releases Sarge (3.1) and earlier, /etc/localtime was a symbolic link. It was changed to a regular file (a copy of a /usr/share/zoneinfo/ file) in Etch (4.0), and remained so until Stretch (9), at which time it was made a symbolic link again.

According to the dates from https://en.wikipedia.org/wiki/Debian_version_history, this means that some Debian releases between 2007-04-08 and 2020-07-18 used a regular file instead of a symlink for /etc/localtime, a behavior we don't currently support. Instead, the timezone name should be obtained from /etc/timezone, a Debian-specific file.

It's worth noting that the Debian releases in question are all past their long-term support guarantees and are considered old. Still, if they are still widespread, it may be worth it to include the required workaround.

@TarunVishwakarma1
Copy link

TarunVishwakarma1 commented Sep 26, 2024

Hey, I want to confirm the logic if I'm correct on a high level. If the /etc/localtime file exists then we get the data from this file else we move to /etc/timezone file. As both the file contains the zoneID in same formate it will not affect the logic.

Am I right ?

@DmitryNekrasov DmitryNekrasov self-assigned this Mar 12, 2025
@fzhinkin
Copy link
Contributor

if they are still widespread

Are they?

@fzhinkin
Copy link
Contributor

Also, there might be no /etc/localtime file at all: llvm/llvm-project#105634

@dkhalanskyjb
Copy link
Collaborator Author

Are they?

It's at least plausible that someone will encounter this problem without using a woefully outdated system. For example, Ubuntu 14.04, based on Debian 8, is still supported under the legacy LTS program: https://ubuntu.com/about/release-cycle

Also, there might be no /etc/localtime file at all

Yes, we already support this: a86e7f8

DmitryNekrasov added a commit that referenced this issue Mar 14, 2025
DmitryNekrasov added a commit that referenced this issue Mar 14, 2025
DmitryNekrasov added a commit that referenced this issue Mar 14, 2025
@DmitryNekrasov
Copy link
Contributor

DmitryNekrasov commented Mar 17, 2025

I see the next output on gentoo stage3:

docker run -i -t --platform linux/amd64 gentoo/stage3
d3b60aa6dbc7 / # ls -l /etc/localtime
lrwxrwxrwx 1 root root 29 Mar  9 17:12 /etc/localtime -> ../usr/share/zoneinfo/Factory
d3b60aa6dbc7 / # ls -la ../usr/share/zoneinfo/Factory
-rw-r--r-- 1 root root 116 Feb 23 17:15 ../usr/share/zoneinfo/Factory
d3b60aa6dbc7 / # cat ../usr/share/zoneinfo/Factory
TZif2-00TZif2-00
<-00>0
d3b60aa6dbc7 / # cat /etc/timezone
UTC

@dkhalanskyjb What do you think about this output?

@dkhalanskyjb
Copy link
Collaborator Author

@DmitryNekrasov, we can support this if someone complains. I wouldn't do that proactively, as having Factory as the time zone is both 1) non-compliant according to https://www.man7.org/linux/man-pages/man5/localtime.5.html and 2) only occurs in misconfigured systems. The problem with Debian is that, although non-compliant (so Debian is in the wrong), it's still possible without the user doing anything wrong.

DmitryNekrasov added a commit that referenced this issue Mar 19, 2025
DmitryNekrasov added a commit that referenced this issue Mar 19, 2025
DmitryNekrasov added a commit that referenced this issue Mar 19, 2025
DmitryNekrasov added a commit that referenced this issue Mar 19, 2025
DmitryNekrasov added a commit that referenced this issue Mar 25, 2025
DmitryNekrasov added a commit that referenced this issue Mar 26, 2025
DmitryNekrasov added a commit that referenced this issue Mar 26, 2025
DmitryNekrasov added a commit that referenced this issue Mar 26, 2025
DmitryNekrasov added a commit that referenced this issue Mar 26, 2025
DmitryNekrasov added a commit that referenced this issue Mar 27, 2025
DmitryNekrasov added a commit that referenced this issue Mar 27, 2025
DmitryNekrasov added a commit that referenced this issue Mar 27, 2025
DmitryNekrasov added a commit that referenced this issue Mar 27, 2025
DmitryNekrasov added a commit that referenced this issue Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants