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: LoadLocationFromTZData with slim tzdata uses wrong cached zone #42216

Closed
hlubek opened this issue Oct 26, 2020 · 6 comments
Closed

time: LoadLocationFromTZData with slim tzdata uses wrong cached zone #42216

hlubek opened this issue Oct 26, 2020 · 6 comments

Comments

@hlubek
Copy link

hlubek commented Oct 26, 2020

What version of Go are you using (go version)?

$ go version
go version devel +146dd2e134 Mon Oct 26 13:44:44 2020 +0100 darwin/amd64

Does this issue reproduce with the latest release?

Yes, it can be reproduced with 1.15: see #42138 .

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hlubek/Library/Caches/go-build"
GOENV="/Users/hlubek/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/hlubek/Dev/Go/local/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/hlubek/Dev/Go/local"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/hlubek/Dev/Go/tip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/hlubek/Dev/Go/tip/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/tq/c8vr5k7928n1vpxb0cdw276c0000gn/T/go-build497574509=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  • Compile Go binary (without embedded tzdata)
  • Add to Alpine Docker image with installed tzdata package (which uses slim zoneinfo with IANA 2020b)
  • Times in e.g. Europe/Berlin have wrong zone (CEST instead of CET) after October, 25th

See https://gist.github.com/hlubek/f46a73bc9d150cf1f2af585b0849e3d9 on how to reproduce.

What did you expect to see?

The correct time zone for the dates in CET.

What did you see instead?

The zone CEST.

Notes

It seems to be the case, that the cached zone which is calculated from the transitions in LoadLocationFromTZData just uses the last transition zone instead of checking for the correct zone from the result of tzset when using the extend data from the time zone file.

@gopherbot
Copy link

Change https://golang.org/cl/264939 mentions this issue: time: fix LoadLocationFromTZData with slim tzdata

@dsantos
Copy link

dsantos commented Oct 29, 2020

Is this going to be backported to 1.15?

@ianlancetaylor
Copy link
Contributor

I expect so.

@gopherbot
Copy link

Change https://golang.org/cl/266299 mentions this issue: [release-branch.go1.15] time: fix LoadLocationFromTZData with slim tzdata

gopherbot pushed a commit that referenced this issue Oct 29, 2020
…data

The extend information of a time zone file with last transition < now
could result in a wrong cached zone because it used the zone of the
last transition.

This could lead to wrong zones in systems with slim zoneinfo.

For #42216
Fixes #42138

Change-Id: I7c57c35b5cfa58482ac7925b5d86618c52f5444d
Reviewed-on: https://go-review.googlesource.com/c/go/+/264939
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 70e022e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/266299
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
@thanm
Copy link
Contributor

thanm commented Nov 11, 2020

<comment removed, picked wrong issue, sorry>

@gopherbot
Copy link

Backport issue(s) opened: #42520 (for 1.15).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants