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

cmd/go: TestScripts/svn fails if TZ database not installed #56527

Closed
qmuntal opened this issue Nov 2, 2022 · 6 comments
Closed

cmd/go: TestScripts/svn fails if TZ database not installed #56527

qmuntal opened this issue Nov 2, 2022 · 6 comments
Assignees
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@qmuntal
Copy link
Contributor

qmuntal commented Nov 2, 2022

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

$ go version
go version devel go1.20-3ba3b4893f Wed Nov 2 14:43:52 2022 +0000 linux/amd64

Does this issue reproduce with the latest release?

Only in tip

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

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/src/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.20-3ba3b4893f Wed Nov 2 14:43:52 2022 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/usr/local/src/go/src/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3269867307=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go test -run TestScripts/svn/hello -count 1 ./cmd/go/internal/vcweb/vcstest

What did you expect to see?

ok cmd/go/internal/vcweb/vcstest 0.155s

What did you see instead?

  vcstest_test.go:136: 2022/11/02 07:32:23 hello.txt:
        > handle svn
        > env TZ='America/New_York'
        > mkdir db/transactions
        > mkdir db/txn-protorevs
        > chmod 0755 hooks/pre-revprop-change
        > env ROOT=$PWD
        > cd .checkout
        > svn checkout file://$ROOT .
        [stdout]
        Checked out revision 0.
        > svn add hello.go
        [stdout]
        A         hello.go
        > svn commit --file MSG
        [stdout]
        Adding         hello.go
        Transmitting file data .done
        Committing transaction...
        Committed revision 1.
        > svn propset svn:author 'rsc' --revprop -r1
        [stdout]
        property 'svn:author' set on repository revision 1
        > svn propset svn:date '2017-09-22T01:12:45.861368Z' --revprop -r1
        [stdout]
        property 'svn:date' set on repository revision 1
        > svn update
        [stdout]
        Updating '.':
        At revision 1.
        > svn log
        [stdout]
        ------------------------------------------------------------------------
        r1 | rsc | 2017-09-22 01:12:45 +0000 (Fri, 22 Sep 2017) | 3 lines
        
        hello world
        
        
        ------------------------------------------------------------------------
        > cmp stdout .svn-log
        diff stdout .svn-log
        --- stdout
        +++ .svn-log
        @@ -1,5 +1,5 @@
         ------------------------------------------------------------------------
        -r1 | rsc | 2017-09-22 01:12:45 +0000 (Fri, 22 Sep 2017) | 3 lines
        +r1 | rsc | 2017-09-21 21:12:45 -0400 (Thu, 21 Sep 2017) | 3 lines
         
         hello world

Additional info

@qmuntal
Copy link
Contributor Author

qmuntal commented Nov 2, 2022

The TestScripts/svn tests are not hermetic, they set TZ='America/New_York' at the beginning and expect svn to honor that time zone when formatting date strings. Unfortunately, svn can only format dates using UTC if the TZ database is not installed.

These are the offending lines:

        > cmp stdout .svn-log
        diff stdout .svn-log
        --- stdout
        +++ .svn-log
        @@ -1,5 +1,5 @@
         ------------------------------------------------------------------------
        -r1 | rsc | 2017-09-22 01:12:45 +0000 (Fri, 22 Sep 2017) | 3 lines
        +r1 | rsc | 2017-09-21 21:12:45 -0400 (Thu, 21 Sep 2017) | 3 lines

The first date timezone is UTC and has been formatted by svn (not honoring TZ).
The second date timezone is UTC-4 and is hardcoded in the test case (here).

@bcmills

@qmuntal
Copy link
Contributor Author

qmuntal commented Nov 2, 2022

I believe that we can fix this issue by changing env TZ='America/New_York' to env TZ='' and updating the hardcoded date to be formatted as UTC. This way we wouldn't need the TZ database, and the test coverage would remain the same (IMO).

@gopherbot
Copy link

Change https://go.dev/cl/447335 mentions this issue: cmd/go: update TestScripts/svn to not depend on TZ database

@bcmills
Copy link
Member

bcmills commented Nov 2, 2022

That seems like a fine solution as long as the tests that use that repo don't depend on that timezone information.

@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Nov 3, 2022
@bcmills bcmills added this to the Go1.20 milestone Nov 3, 2022
romaindoumenc pushed a commit to TroutSoftware/go that referenced this issue Nov 3, 2022
`TestScripts/svn` test suite fails if the host does not have a TZ
database installed.

This CL updates those tests so SVN formats dates using UTC, which
don't require a TZ database.

Fixes golang#56527

Change-Id: I20f3c03c3cedd7d748f4623dddc66bd04d1df318
Reviewed-on: https://go-review.googlesource.com/c/go/+/447335
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
@bcmills bcmills reopened this Nov 3, 2022
@gopherbot
Copy link

Change https://go.dev/cl/447795 mentions this issue: cmd/go: set TZ=UTC explicitly for svn vcstest repos

@gopherbot
Copy link

Change https://go.dev/cl/447935 mentions this issue: cmd/go: fix svn vctest on Windows and make them timezone agnostic

@golang golang locked and limited conversation to collaborators Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

3 participants