Skip to content

os: TestUserConfigDir and TestUserCacheDir expect writable $HOME on linux #64990

@zhsj

Description

@zhsj

Go version

go version go1.22rc1 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/zsj/.cache/go-build'
GOENV='/home/zsj/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/zsj/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/zsj/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn'
GOROOT='/home/zsj/Workspaces/debian/package/pkg-go/build-area/x/usr/lib/go-1.22'
GOSUMDB='sum.golang.google.cn'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/zsj/Workspaces/debian/package/pkg-go/build-area/x/usr/lib/go-1.22/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22rc1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -ffile-prefix-map=/tmp/go-build3035930955=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Building Go 1.22 on Debian build system.

What did you see happen?

https://buildd.debian.org/status/fetch.php?pkg=golang-1.22&arch=arm64&ver=1.22%7Erc1-1&stamp=1704505334&raw=0

--- FAIL: TestUserConfigDir (0.00s)
    os_test.go:2874: could not create UserConfigDir: mkdir /sbuild-nonexistent: permission denied
--- FAIL: TestUserCacheDir (0.00s)
    os_test.go:2851: could not create UserCacheDir: mkdir /sbuild-nonexistent: permission denied

What did you expect to see?

Build successfully without distro patch.

While reading #57630 and #57638, @bcmills said

Perhaps it should return an error if the chosen directory is not writable

However UserConfigDir and UserCacheDir don't report such error, and only the tests expect the returned paths are writable.

The Debian build system is intentionally configured to have a non-writable $HOME dir. Previously the Debian package carries a patch to skip TestUserHomeDir which failed if $HOME is not writable. However this is fixed in bb4ea80. But for the new added TestUserConfigDir and TestUserCacheDir, they fail again.

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.TestingAn issue that has been verified to require only test changes, not just a test failure.release-blocker

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions