-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: executable FileMode bit is not set on Windows #41809
Comments
How do you suggest we decide whether a file is executable on Windows? |
I'm sorry I don't have a solid idea. But wouldn't the following quote help?
|
Can I ask, if go were changed to return the mode bits you propose, what problem would that allow you to solve? Perhaps there is another way to accomplish what you need without wading into the depths of Unix file permissions on a platform that isn’t Unix. Do you think that is possible? |
There is a plugin system in a cli-based tool called kustomize, which supports exec type and go library type.
I think it is possible. However, from the kustomize project's point of view(although I am not an active contributor), it also seems necessary to check whether the standard library will support this feature in the future in any way. |
I do not agree with this. File permissions and ACLs need to be distinguished. Whereas the file's permissions indicate whether the file itself is executable or not, the ACL indicates whether the file is accessible or not for the user. Also, File permissions must be persistent when copied to another file system. Windows file system has no executable bits for executables. Also we can't determine file extension. For example, we can execute script files using PATHEXT enviroment variable. One more thing I have to mention about this. Windows can execute without .exe, .bat, .com or file extensions contains in PATHEXT.
Probably cmd.exe is looking magick-word |
What about the GetBinaryTypeW function? I have a POC using the golang.org/x/sys/windows package, passing the path of an executable file with arbitrary file extension, receiving the value 6 (SCS_64BIT_BINARY) = "A 64-bit Windows-based application.". |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran the code to check if a file is executable on Windows.
What did you expect to see?
Bit operation was performed to implement a function that checks whether a file is executable. However, it seems that the executable bit is not set even though it is an executable file on Windows.
(493==0755)
What did you see instead?
(438==0644)
The text was updated successfully, but these errors were encountered: