-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: IsNotExist returns true for invalid file names #23105
Comments
This is probably a duplicate of #18974 |
Responding to The code looks very misleading to me: just because |
Shouldn't the issue title read |
@slrz Upon reflection, I think you're right. One could imagine a deep set of directories, |
I don't think this should be fixed. non-nil err does not mean |
@mattn https://play.golang.org/p/MPqPCmPcjE The linux man(3) page about errno defines From https://en.wikipedia.org/wiki/Filename and https://en.wikipedia.org/wiki/Path_(computing) it seems that pathname and filename are equivalent, so I don't understand why in my code os.Stat returns |
@perillo, you need to handle your errors, of which IsNotExist is just one scenario. @mattn's example https://play.golang.org/p/BnbP5Lik-l is the right way to do it (apart from unnecessary nesting). As far as I can tell, there is no bug here. |
Please don't change the functionality of os.IsNotExist for ENAMETOOLONG or the various Windows cases. |
Sounds like we don't want to change anything here and there's no bug. |
What version of Go are you using (
go version
)?go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN="/home/manlio/.local/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/manlio/.local/lib/go:/home/manlio/code/src/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build134836490=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
https://play.golang.org/p/7xo02WfeHR
Also, see https://groups.google.com/forum/#!topic/golang-nuts/MZ_u50ZIB_I
What did you expect to see?
file does not exist
What did you see instead?
file exist
stat xxx...xxx: File name too long
The text was updated successfully, but these errors were encountered: