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

time: loadZoneInfo should allow version 3 #8134

Closed
gopherbot opened this issue Jun 2, 2014 · 6 comments
Closed

time: loadZoneInfo should allow version 3 #8134

gopherbot opened this issue Jun 2, 2014 · 6 comments
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 2, 2014

by roarofthefour:

The time zone records for Israel, Gaza, and some other places are not available via the
"time" package anymore, if you are using recent versions of zoneinfo.zip (such
as the one supplied with Go 1.2).

You can get at these time zone records if your zoneinfo.zip is old enough.

That's not good because zoneinfo.zip needs to be kept up-to-date with the latest changes
to Daylight Savings Time rules by various governments of the world.

Records for IANA time zones in zoneinfo.zip contain a version number.
Most records are version 2.
Some of them are version 3 now, such as Asia/Jerusalem, Asia/Gaza.

The following lines in the function loadZoneData

// 1-byte version, then 15 bytes of padding
    var p []byte
    if p = d.read(16); len(p) != 16 || p[0] != 0 && p[0] != '2' {
        return nil, badData
    }

should be changed to

// 1-byte version, then 15 bytes of padding
    var p []byte
    if p = d.read(16); len(p) != 16 || p[0] != 0 && p[0] != '2' || p[0] != '3' {
        return nil, badData
    }

to accommodate version 3.

The difference between version 2 records and version 3 does not concern loadZoneInfo,
because it does not read the part of the record which may be different under version 3,
that is, the POSIX TZ string.
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 2, 2014

Comment 1 by roarofthefour:

My mistake - it should be changed to this (&& instead of ||)
// 1-byte version, then 15 bytes of padding
    var p []byte
    if p = d.read(16); len(p) != 16 || p[0] != 0 && p[0] != '2' && p[0] != '3' {
        return nil, badData
    }
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 3, 2014

Comment 2:

Labels changed: added repo-main, release-go1.3maybe.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 3, 2014

Comment 3:

CL https://golang.org/cl/100930044 mentions this issue.
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 3, 2014

Comment 4:

This issue was closed by revision 14a75ec.

Status changed to Fixed.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 3, 2014

Comment 5:

CL https://golang.org/cl/96690043 mentions this issue.
@dsymonds
Copy link
Member

@dsymonds dsymonds commented Jun 3, 2014

Comment 6:

This issue was closed by revision eee406e46a11.

@gopherbot gopherbot added fixed labels Jun 3, 2014
@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3maybe label Apr 14, 2015
dsymonds added a commit that referenced this issue May 11, 2015
««« CL 100930044 / fde405c62fca
time: support version 3 zone records

Fixes #8134

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r, rsc
https://golang.org/cl/100930044
»»»

LGTM=rsc
R=adg, rsc
CC=golang-codereviews
https://golang.org/cl/96690043
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#8134

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r, rsc
https://golang.org/cl/100930044
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.