-
Notifications
You must be signed in to change notification settings - Fork 18k
time: misleading "zoneinfo.zip: no such file or directory" error when trying to load non-existent timezone #20969
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
Comments
Not a regression from Go 1.8 (or any other prior release), so targeting Go 1.10 for consideration. I don't think it's a good idea to get rid of the part of the error message that says where it was looking to find the answer (which zip file path). You want it to say both things? Failed to find New_Yaark and also the zip file path? |
i'm not sure TBH. to be clear, is it perfectly normal to have situations where only a few timezones are installed, and where it can only know for sure that a tz doesn't exist if it can check against a zoneinfo.zip file? |
@Dieterbe the alternative would be to embed the whole IANA Time Zone database in the binary(?) I agree we could try to print a better error, though (even if the current one is technically correct). |
@ALTree, some discussion of that is in #20629 (comment). |
can somebody answer:
(i hope that question did not come across snarky or sarcastic. I just need clarity on that before I can think of suggestions for improvement) |
@Dieterbe, oh, I see what you're suggesting now. That if, say, That's a possibility. I don't believe the intent of the current code is to blend two sources of information (zoneinfo dir and zip), but just to try the zip if the file on disk doesn't exist. IIRC, currently the code just tries to open a single file under |
Analysis: The code directly checks for a file under So we need to check for the existence of a zoneinfo dir first, and then check for the file inside the dir if it exists and return a similar non Only thing is, I will need to copy over a minimal implementation of Will send a CL. |
Change https://golang.org/cl/121877 mentions this issue: |
Change https://golang.org/cl/135416 mentions this issue: |
This makes Android consistent with the change in CL 121877. Updates #20969 Change-Id: I1f114556fd1d4654c8e4e6a59513bddd5dc3d1a0 Reviewed-on: https://go-review.googlesource.com/135416 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Elias Naur <elias.naur@gmail.com>
Change https://golang.org/cl/155538 mentions this issue: |
Updates #20969 Change-Id: Ibcf0bf932d5b1de67c22c63dd8514ed7a5d198fb Reviewed-on: https://go-review.googlesource.com/c/155538 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
May I know what is the fix for this issue? I ran into the same issue, go runtime fails to convert time if the timezone is "Asia/kolkata" but works with "Asia/Calcutta" it runs of my local machine(go version 1.11.4 , Ubuntu 18.X) but not on server (Ubuntu 16.x). I appreciate your help !! |
@pagidi This issue was closed months ago. For help with Go, please see https://golang.org/wiki/Questions. On Ubuntu timezone information comes from files in the /usr/share/zoneinfo directory. So if a timezone works on one system but not another, it means that the two systems have different zoneinfo files. |
Thanks @tsuz But My problem seems different. Is there way, we can give path in the Go program to look for the zoneinfo.zip??? |
Please look into the documentation - https://golang.org/pkg/time/#LoadLocation.
I would suggest to update the zone information on your remote server. If that does not work, use the ZONEINFO variable. In future, for Go related questions please use the forums in https://golang.org/wiki/Questions. Closed issues are not monitored. Thanks. |
Thanks for the help! @agnivade Though I have used ZONEINFO variable it didn't work, am I missing something here? $ locate zoneinfo it means zoneinfo is located in user/share/zoneinfo/ $export ZONEINFO=/usr/share/zoneinfo/ Still I see application throws below Error. |
Because you use the wrong directory in your export |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +be855e3f28 Mon Jun 19 23:26:32 2017 +0000 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
note that when I run it on my host which does have a zoneinfo.zip I get:
The text was updated successfully, but these errors were encountered: