https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112019-06-11T19:07:38ZRuby Issue Tracking SystemRuby master - Bug #15664: File.executable returns incorrect results in Windows 10https://bugs.ruby-lang.org/issues/15664?journal_id=784472019-06-11T19:07:38Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>File</strong> <a href="/attachments/7834">file-executable-doc.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/7834/file-executable-doc.patch">file-executable-doc.patch</a> added</li></ul><p>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: <code>.bat</code>, <code>.cmd</code>, <code>.com</code>, <code>.exe</code>. See <a href="https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5598-L5602" class="external">https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L5598-L5602</a></p>
<p>I don't think this is fixable unless we want to make <code>File.executable?</code> an alias to <code>File.readable?</code> on Windows, and that would just result in the opposite issue, with <code>File.executable?</code> returning <code>true</code> for files that are just readable and not actually executable.</p>
<p>The documentation for <code>File.executable</code> and <code>File.executable_real?</code> 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.</p> Ruby master - Bug #15664: File.executable returns incorrect results in Windows 10https://bugs.ruby-lang.org/issues/15664?journal_id=784622019-06-12T00:07:52Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>I agree on the documentation fix, but I guess that <code>Gem.bin_path</code> should return the proper stub file path in this case.</p> Ruby master - Bug #15664: File.executable returns incorrect results in Windows 10https://bugs.ruby-lang.org/issues/15664?journal_id=786552019-06-17T21:05:44Zjeremyevans (Jeremy Evans)code@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Update documentation for File.executable{,_real}? to mention Windows issues Fixes [Bug #15664]" href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/c8edf70cd20b9ff72ebd1e9402a556089f6ff204">git|c8edf70cd20b9ff72ebd1e9402a556089f6ff204</a>.</p>
<hr>
<p>Update documentation for File.executable{,_real}? to mention Windows issues</p>
<p>Fixes [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: File.executable returns incorrect results in Windows 10 (Closed)" href="https://bugs.ruby-lang.org/issues/15664">#15664</a>]</p>