-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.CriticalA critical problem that affects the availability or correctness of production systems built using GoA critical problem that affects the availability or correctness of production systems built using GoFixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.OS-OpenBSD
Milestone
Description
Go version
go version go1.24.2 openbsd/amd64
Output of go env
in your module/workspace:
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/jrick/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/jrick/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3747953386=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='openbsd'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/jrick/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='openbsd'
GOPATH='/home/jrick/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/jrick/src/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/jrick/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/home/jrick/src/go/pkg/tool/openbsd_amd64'
GOVCS=''
GOVERSION='go1.24.2'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Test program:
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
rootPath, err := os.MkdirTemp("", "root")
if err != nil {
panic(err)
}
fmt.Println("tmp path", rootPath)
r, err := os.OpenRoot(rootPath)
if err != nil {
panic(err)
}
err = r.Mkdir("d", 0o777)
if err != nil {
panic(err)
}
if st, err := os.Stat(filepath.Join(r.Name(), "d")); err == nil {
fmt.Printf("%q mode %#o\n", st.Name(), st.Mode())
}
_, err = r.OpenRoot("d")
if err != nil {
panic(err)
}
}
What did you see happen?
On OpenBSD, os.Root.Mkdir creates a directory with perm mode 0o000:
$ go run .
tmp path /tmp/root2057846600
"d" mode 020000000000
panic: openat d: permission denied
goroutine 1 [running]:
main.main()
/home/jrick/hack/root-mkdir/a.go:32 +0x249
exit status 2
$ ls -l /tmp/root2057846600
total 4
d--------- 2 jrick wheel 512 Apr 30 17:01 d/
It works as expected on Linux:
$ go run .
tmp path /tmp/root3220349710
"d" mode 020000000755
$ echo $?
0
$ ls -l /tmp/root3220349710
total 1
drwxr-xr-x 2 jrick users 2 Apr 30 17:04 d/
What did you expect to see?
os.Root.Mkdir creating a directory with the proper permissions.
magisterquis
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.CriticalA critical problem that affects the availability or correctness of production systems built using GoA critical problem that affects the availability or correctness of production systems built using GoFixPendingIssues that have a fix which has not yet been reviewed or submitted.Issues that have a fix which has not yet been reviewed or submitted.OS-OpenBSD