-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Description
- What version of Go are you using (
go version)?
go version go1.6.1 linux/amd64
- What operating system and processor architecture are you using (
go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
- What did you do?
Given any file descriptor correctly opened with a write-only access level, reading from it correctly returns the errno EBADF as specified in read(2):
EBADF fd is not a valid file descriptor or is not open for reading.
But os.IsPermission() does not check this case and returns false instead of true.
https://play.golang.org/p/sPZWxH5JA7
The context provided by os.PathError should allow to return true correctly.
Regarding the case "fd is not a valid file descriptor", it could be excluded by also checking that the file descriptor is valid with something like fcntl(fd, F_GETFD) (but the fd is not in the error context).
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.