Skip to content
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

Exa does not read the TZ environment variable, but it is a standard way to convey timezone data on musl #453

Closed
CosmicToast opened this issue Dec 14, 2018 · 6 comments · Fixed by #725

Comments

@CosmicToast
Copy link

On musl, the way to set the timezone is by having a TZ environment variable.
See its documentation for reference.

Currently, when running exa -l, the following output appears on such a system:

Unable to determine time zone: No such file or directory (os error 2)

Note that date (both GNU and busybox implementation) output the correct time information with no warnings:

Fri Dec 14 00:13:10 EST 2018
@Don42
Copy link
Contributor

Don42 commented Feb 13, 2019

I checked the code and exa does not read the TZ environment variable. Instead it tries to get the timezone from /etc/localtime. So this isn't an issue with musl libc more of a general missing feature.
Could you edit the title to reflect that exa does not read the TZ environment variable but probably should.

This would be a very localized change in src/output/table.rs:266. So it might be a good first issue if someone wants to give it a try.

@CosmicToast CosmicToast changed the title Exa claims timezone can't be determined on musl Exa does not read the TZ environment variable, but it is a standard way to convey timezone data on musl Feb 13, 2019
@gyscos
Copy link
Contributor

gyscos commented Aug 11, 2019

Note: on termux (the android terminal emulator), by default neither $TZ nor /etc/localtime are available.
It seems it has timezone info at /system/usr/share/zoneinfo/tzdata. Not sure how to get that path from exa. The environment only has ANDROID_ROOT=/system ; but I don't know when we should look for this.

@pfr-dev
Copy link

pfr-dev commented Feb 21, 2020

I've come across this issue also. Happy to test solutions if someone can walk me through it. I only use termux to play around on so i'm not worried about breaking it.

@RupankarGhosh
Copy link

RupankarGhosh commented Apr 20, 2020

Creating a localtime file in /etc/ folder with proper timezone will eliminates this problem. I have alpine on termux and there was no /etc/localtime file so I did as follows:

apk add tzdata 
cat '/usr/share/zoneinfo/Asia/Calcutta' > /etc/localtime

It worked for me.

@CosmicToast
Copy link
Author

The bug is about reading the TZ environment variable, not about parsing /etc/localtime.

@kbravh
Copy link
Contributor

kbravh commented Aug 26, 2020

I've created a pull request that will have exa first check the TZ environment variable before defaulting to /etc/localtime. This will work on linux distros that store timezone data in /usr/share/zoneinfo.

Termux on Android still poses a problem since timezone data is instead stored in one large file: /system/usr/share/zoneinfo/tzdata, but it's out of the scope of this issue.

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

Successfully merging a pull request may close this issue.

6 participants