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: fsync on AIX on read-only files fails, should instead use fsync_range #41372

Closed
aklyachkin opened this issue Sep 14, 2020 · 2 comments
Closed

Comments

@aklyachkin
Copy link

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

$ go version
go version go1.14.2 aix/ppc64

Does this issue reproduce with the latest release?

This is the latest release available for AIX

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

go env Output
$ go env
GO111MODULE=""
GOARCH="ppc64"
GOBIN=""
GOCACHE="/.cache/go-build"
GOENV="/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="ppc64"
GOHOSTOS="aix"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="aix"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/freeware/lib/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/freeware/lib/golang/pkg/tool/aix_ppc64"
GCCGO="gccgo"
GOPPC64="power8"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -maix64 -pthread -mcmodel=large -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build220147562=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/PwSeWwxFj5B

# touch /tmp/1
# go run a.go
os.Sync(): sync /tmp/1: bad file number
Op: sync, Path: /tmp/1, Err: bad file number

What did you expect to see?

nothing ;-)

What did you see instead?

# touch /tmp/1
# go run a.go
os.Sync(): sync /tmp/1: bad file number
Op: sync, Path: /tmp/1, Err: bad file number

See the comment of Clément Chigot here - https://community.ibm.com/community/user/power/communities/community-home/digestviewer/viewthread?GroupId=6211&MessageKey=e0af00d7-1005-4acf-99b7-e0787e4cb463&CommunityKey=10c1d831-47ee-4d92-a138-b03f7896f7c9&tab=digestviewer&ReturnUrl=%2fcommunity%2fuser%2fpower%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3d10c1d831-47ee-4d92-a138-b03f7896f7c9%26tab%3ddigestviewer

With os.O_RDWR instead of os.RDONLY it works.

@Helflym
Copy link
Contributor

Helflym commented Sep 14, 2020

As I said in IBM forum, using fsync_range instead of fsync should work. I'm trying the patch right now and will submit it after that.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/254657 mentions this issue: syscall: fix fsync for read-only files on aix

@odeke-em odeke-em changed the title AIX golang os.Fsync() problem os: fsync on AIX on read-only files fails, should instead use fsync_range Sep 14, 2020
@odeke-em odeke-em added this to the Go1.16 milestone Sep 14, 2020
@golang golang locked and limited conversation to collaborators Sep 14, 2021
@rsc rsc unassigned Helflym Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants