Bug #15664
closedFile.executable returns incorrect results in Windows 10
Description
Calling File.executable? in Windows 10 return false for a file with execute permissions set.
Files
Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago
Unlike Unix, Windows doesn't support execute permissions separately. If the path is a regular file, Ruby currently uses file extensions to determine if a file is executable, and only considers the following extensions as executable: .bat
, .cmd
, .com
, .exe
. See https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5598-L5602
I don't think this is fixable unless we want to make File.executable?
an alias to File.readable?
on Windows, and that would just result in the opposite issue, with File.executable?
returning true
for files that are just readable and not actually executable.
The documentation for File.executable
and File.executable_real?
does not currently reflect the issues on Windows. Attached is a documentation patch to explain the behavior. I plan to commit this in about a week unless I hear objections.
Updated by nobu (Nobuyoshi Nakada) almost 5 years ago
I agree on the documentation fix, but I guess that Gem.bin_path
should return the proper stub file path in this case.
Updated by jeremyevans (Jeremy Evans) almost 5 years ago
- Status changed from Open to Closed
Applied in changeset git|c8edf70cd20b9ff72ebd1e9402a556089f6ff204.
Update documentation for File.executable{,_real}? to mention Windows issues
Fixes [Bug #15664]