-
Notifications
You must be signed in to change notification settings - Fork 380
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
server: use os.IsNotExist to map sshFxNoSuchFile #382
Conversation
Always use os.IsNotExist to identify any OS specific error types that represent missing files or directories. This resolves an issue on Windows where some system errors (ENOTDIR) were not being identified as 'not found' errors and mapped to sshFxNoSuchFile. fixes #381
update github.com/bradfitz/latlong in order to pick up bradfitz/latlong@afb97c1f9 which updates the import path of freetype-go. The old path no longer exists and was causing problems with go mod. update github.com/pkg/sftp for pkg/sftp#382 which resolves CI test failures for Windows.
update github.com/bradfitz/latlong in order to pick up bradfitz/latlong@afb97c1f9 which updates the import path of freetype-go. The old path no longer exists and was causing problems with go mod. update github.com/pkg/sftp for pkg/sftp#382 which resolves CI test failures for Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might be able to refactor to cover all os.IsNotExist(…)
cases better.
At the very least, we should be using os.IsNotExist(e)
as well, instead of the more fragile case os.ErrNotExist:
Return early from statusFromError if os.IsNotExist is true.
technically, this means we could also remove the |
Up to you, if you want to remove the ENOENT case. Like you say, we should never hit it anymore. But I am going to guess that it’s not actually too much code or binary bloat, so it might be better to keep it around as a just in case backup? 🤷♀️ I’m fine either way. |
yeah, I think probably leave it in. 👍 Given what the function is doing... mapping syscall error numbers to ssh error codes, it makes sense for it to have fuller coverage of different error numbers. That keeps it somewhat semantically independent of the statusFromError func. |
update github.com/bradfitz/latlong in order to include bradfitz/latlong@afb97c1f9 which updates the import path of freetype-go. The old path no longer exists and was causing problems with go mod. update github.com/pkg/sftp to include pkg/sftp#382 which resolves CI test failures for Windows.
update github.com/bradfitz/latlong in order to include bradfitz/latlong@afb97c1f9 which updates the import path of freetype-go. The old path no longer exists and was causing problems with go mod. update github.com/pkg/sftp to include pkg/sftp#382 which resolves CI test failures for Windows.
update github.com/bradfitz/latlong in order to include bradfitz/latlong@afb97c1f9 which updates the import path of freetype-go. The old path no longer exists and was causing problems with go mod. update github.com/pkg/sftp to include pkg/sftp#382 which resolves CI test failures for Windows.
update github.com/bradfitz/latlong in order to include bradfitz/latlong@afb97c1f9 which updates the import path of freetype-go. The old path no longer exists and was causing problems with go mod. update github.com/pkg/sftp to include pkg/sftp#382 which resolves CI test failures for Windows.
Always use os.IsNotExist to identify any OS specific error types that represent missing files or directories. This resolves an issue on Windows where some system errors (ENOTDIR) were not being identified as 'not found' errors and mapped to sshFxNoSuchFile.
fixes #381