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

os: FileInfo indicates that Solaris doors are regular files #52259

Closed
gco opened this issue Apr 10, 2022 · 2 comments
Closed

os: FileInfo indicates that Solaris doors are regular files #52259

gco opened this issue Apr 10, 2022 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Solaris

Comments

@gco
Copy link

gco commented Apr 10, 2022

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

$ go version
go version go1.18 solaris/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="solaris"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="solaris"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/pkg/go118"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/pkg/go118/pkg/tool/solaris_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="/usr/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
GOWORK=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1940893624=/tmp/go-build -gno-record-gcc-switches"

What did you do?

As discovered using restic, os.FileInfo claims that Solaris Doors are regular files. This is due to missing cases in the switch statement in os/stat_solaris.go.

What did you expect to see?

Unclear. there's no Door type in os/types.go. It could be ModeIrregular?

What did you see instead?

0, regular file

@gco gco changed the title affected/package: os FileInfo indicates that Solaris doors are regular files (affected/package: os) Apr 10, 2022
@gco gco changed the title FileInfo indicates that Solaris doors are regular files (affected/package: os) os/Stat: FileInfo indicates that Solaris doors are regular files Apr 10, 2022
@gco
Copy link
Author

gco commented Apr 10, 2022

This works for me, exposing the OS-specific file types (doors and event ports) as irregular as proof of concept.

--- ./src/syscall/types_solaris.go.orig 2022-04-09 18:49:38.421104607 -0700
+++ ./src/syscall/types_solaris.go      2022-04-09 18:49:57.891586964 -0700
@@ -116,6 +116,8 @@
        S_IFREG  = C.S_IFREG
        S_IFLNK  = C.S_IFLNK
        S_IFSOCK = C.S_IFSOCK
+       S_IFDOOR = C.S_IFDOOR
+       S_IFPORT = C.S_IFPORT
        S_ISUID  = C.S_ISUID
        S_ISGID  = C.S_ISGID
        S_ISVTX  = C.S_ISVTX
--- ./src/os/stat_solaris.go.orig       2022-04-09 18:51:51.166963104 -0700
+++ ./src/os/stat_solaris.go    2022-04-09 19:16:53.382479381 -0700
@@ -29,6 +29,12 @@
                // nothing to do
        case syscall.S_IFSOCK:
                fs.mode |= ModeSocket
+       case syscall.S_IFDOOR:
+               fs.mode |= ModeIrregular
+       case syscall.S_IFPORT:
+               fs.mode |= ModeIrregular
+       default:
+               fs.mode |= ModeIrregular
        }
        if fs.sys.Mode&syscall.S_ISGID != 0 {
                fs.mode |= ModeSetgid

--- ./src/syscall/ztypes_solaris_amd64.go.orig  2022-04-09 20:09:29.648930686 -0700
+++ ./src/syscall/ztypes_solaris_amd64.go       2022-04-09 20:09:53.654355235 -0700
@@ -73,6 +73,8 @@
        S_IFREG  = 0x8000
        S_IFLNK  = 0xa000
        S_IFSOCK = 0xc000
+       S_IFDOOR = 0xd000
+       S_IFPORT = 0xe000
        S_ISUID  = 0x800
        S_ISGID  = 0x400
        S_ISVTX  = 0x200

@ianlancetaylor ianlancetaylor changed the title os/Stat: FileInfo indicates that Solaris doors are regular files os: FileInfo indicates that Solaris doors are regular files Apr 10, 2022
@gopherbot
Copy link

Change https://go.dev/cl/399435 mentions this issue: os: mark Solaris nam/door/port files as irregular

@seankhliao seankhliao added OS-Solaris NeedsFix The path to resolution is known, but the work has not been done. labels Apr 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Solaris
Projects
None yet
Development

No branches or pull requests

3 participants