8000 fix S_IFMT value on windows, plan9 and js/wasm by eikenb · Pull Request #329 · pkg/sftp · GitHub
[go: up one dir, main page]

Skip to content

fix S_IFMT value on windows, plan9 and js/wasm #329

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

Merged
merged 1 commit into from
Jan 11, 2020

Conversation

eikenb
Copy link
Member
@eikenb eikenb commented Dec 30, 2019

Go defines S_IFMT on windows, plan9 and js/wasm as 0x1f000 instead of 0xf000. None of the the other S_IFxyz values include the "1" (in 0x1f000) which prevents them from matching the bitmask.

This fixes that by overriding the S_IFMT value on the effected platforms to be 0xf000, as it it on all the others.

Fixes #291

@eikenb eikenb added the bug label Dec 30, 2019
@eikenb eikenb added this to the v1.11.0 milestone Dec 30, 2019
syscall_fixed.go Outdated
@@ -0,0 +1,5 @@
// +build plan9 windows
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@eikenb eikenb force-pushed the issue-291-ifmt-platform-fix branch from c38be39 to d9b1aad Compare January 2, 2020 20:57
Go defines S_IFMT on windows, plan9 and js/wasm as 0x1f000 instead of
0xf000. None of the the other S_IFxyz values (even on those mentioned)
include the "1" (in 0x1f000) which prevents them from matching the
bitmask.

This fixes that by overriding the S_IFMT value on the effected platforms
to be 0xf000, as it it on all others.
@eikenb eikenb force-pushed the issue-291-ifmt-platform-fix branch from d9b1aad to 0277caa Compare January 2, 2020 20:59
@eikenb
Copy link
Member Author
eikenb commented Jan 2, 2020

I added js/wasm, updated the commit message and added a comment to the _fixed version noting the reasoning.

@eikenb eikenb changed the title fix S_IFMT value on windows and plan9 fix S_IFMT value on windows, plan9 and js/wasm Jan 2, 2020
Copy link
Collaborator
@puellanivis puellanivis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to double check the build tag directive semantics, but it looks like everything is good. 👍

@eikenb
Copy link
Member Author
eikenb commented Jan 3, 2020

Thanks.

I had to double check the build tags as well. First time I had a that logic combo.

@eikenb eikenb merged commit e6f3825 into master Jan 11, 2020
@eikenb eikenb deleted the issue-291-ifmt-platform-fix branch January 11, 2020 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong value of S_IFMT mask when converting sftp filemode bits to os.FileMode
3 participants
0