Bug #15664


File.executable returns incorrect results in Windows 10

Added by BoldRabbit (Bold Rabbit) over 3 years ago. Updated over 3 years ago.

Target version:


Calling File.executable? in Windows 10 return false for a file with execute permissions set.


RailsTest.PNG (108 KB) RailsTest.PNG ss of the error BoldRabbit (Bold Rabbit), 03/14/2019 12:30 AM
FilePerm.PNG (3.99 KB) FilePerm.PNG actual permissions reported by Windows BoldRabbit (Bold Rabbit), 03/14/2019 12:31 AM
file-executable-doc.patch (1.22 KB) file-executable-doc.patch jeremyevans0 (Jeremy Evans), 06/11/2019 07:06 PM

Updated by jeremyevans0 (Jeremy Evans) over 3 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

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) over 3 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.

Actions #3

Updated by jeremyevans (Jeremy Evans) over 3 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]


Also available in: Atom PDF