Skip to content

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

@hlubek

Description

@hlubek

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions