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

syscall: inconsistent error messages for syscall.ESTALE across architectures #71309

Open
vipnydav opened this issue Jan 17, 2025 · 4 comments
Open
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@vipnydav
Copy link

Go version

go 1.23.4

Output of go env in your module/workspace:

go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/vipinydv_google_com/.cache/go-build'
GOENV='/home/vipinydv_google_com/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/vipinydv_google_com/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/vipinydv_google_com/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/vipinydv_google_com/go/pkg/mod/golang.org/[email protected]'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/vipinydv_google_com/go/pkg/mod/golang.org/[email protected]/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.4'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/vipinydv_google_com/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/vipinydv_google_com/gcsfuse/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 -ffile-prefix-map=/tmp/go-build342134929=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Steps to Reproduce:

  1. Write a Go program that returns the syscall.ESTALE error.
  2. Run the program on an arm64 and amd64 machines and observe the error message.
    FYI : This discrepancy is not limited to these two architectures and exists on other platforms as well.

What did you see happen?

When returning the syscall.ESTALE error in a Go program, the error message displayed to the user varies depending on the machine's architecture. On arm64 machines, users see "stale file handle", while on amd64 machines, they see "stale NFS file handle". This inconsistency violates the principle of consistent error reporting and contradicts the Linux Manual Page, which states that ESTALE applies to both NFS and other filesystems.

What did you expect to see?

The error message for syscall.ESTALE should be "stale file handle" on all architectures.
If needed I can raise a PR for the same.

@vipnydav vipnydav changed the title go/src/syscall: Golang giving different error messages for ESTALE = Errno(0x74) on different architectures. go/src/syscall: Inconsistent error messages for syscall.ESTALE across architectures Jan 17, 2025
@seankhliao seankhliao changed the title go/src/syscall: Inconsistent error messages for syscall.ESTALE across architectures syscall: inconsistent error messages for syscall.ESTALE across architectures Jan 17, 2025
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 17, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Jan 17, 2025
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 17, 2025
@mknyszek mknyszek added this to the Backlog milestone Jan 17, 2025
@mknyszek
Copy link
Contributor

CC @golang/runtime

@ianlancetaylor
Copy link
Member

That is odd, because those strings are generated by calling the C strerror function. But looking at the glibc source code, I see that the default value is "Stale file handle" but that there is a translation in the "en_GB" locale that produces "Stale NFS file handle". I wonder if that somehow led to this confusion. The syscall/mkerror.sh script sets LC_ALL=C, but that was committed December 1, 2009, after "Stale NFS file handle" first appeared in 20a0266 July, 2008. But this doesn't really make sense because the changes claim that zerror_linux_amd64.go was regenerated later. So I don't know what happened.

Fortunately the golang.org/x/sys/unix package seems to get it right.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/643335 mentions this issue: syscall: use consistent message for ESTALE on Linux

@gabyhelp
Copy link

Related Code Changes

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants