Forum: IronRuby FW: File.executable? always returns false on Windows machine

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-04-03 19:57
(Received via mailing list)
Anyone know what File.executable? is supposed to do? For me, it always
returns false. For Jim, Tomas and others, it always returns true no
matter what the file extension is. Any idea why we might be getting
different results?

FWIW, the current IronRuby implementation returns true if the file
extension is ".exe".

Thanks,
Shri

From: Shri Borde
Sent: Thursday, April 02, 2009 3:59 PM
To: ruby-core@ruby-lang.org
Subject: File.executable? always returns false on Windows machine

On my machine, File.executable? is always returning false. I have tried
1.8p27. I am running on a Windows Vista x86 machine. The file system is
NTFS. I can't think of anything unusual about my machine.

What are the semantic supposed to be? Most of the people I have asked
get a value of true for all of the statements below, even for the
File.executable? on the ttf file.

puts File.exists?("C:/windows/fonts/wingding.ttf")
puts File.readable?("C:/windows/fonts/wingding.ttf")
puts File.executable?("C:/windows/fonts/wingding.ttf") # Prints false
only for me

puts File.exists?("C:/windows/notepad.exe")
puts File.readable?("C:/windows/notepad.exe")
puts File.executable?("C:/windows/notepad.exe") # Prints false only for
me

With the 1.9 binaries, File.executable? returns true only if the file
extensions is something like .exe. Again, it always returns true for the
people I have asked.

Thanks,
Shri
68f1bd9e9a7d9d10f0278c6535f700fe?d=identicon&s=25 Michael Letterle (mletterle)
on 2009-04-03 23:48
(Received via mailing list)
On *nix systems it would return true if the executable bit is set and
false
if it's not.  Windows doesn't really have a comparable attribute since
files
are "categorized" based on extension, hence .exe acting as a sort of
"executable bit".
Ade8632553a9243ae05fc920f68644c1?d=identicon&s=25 Jim Deville (Guest)
on 2009-04-04 00:21
(Received via mailing list)
We should probably return true if the extension is in PATHEXT. This
should return true for EXE,COM, CMD, BAT, PS1 (if you have Powershell).
It would be nice if we could inspect whatever assoc touches, so that if
I add an assoc and filetype for RB, it becomes executable.

JD

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Michael
Letterle
Sent: Friday, April 03, 2009 12:04 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] FW: File.executable? always returns false
on Windows machine

On *nix systems it would return true if the executable bit is set and
false if it's not.  Windows doesn't really have a comparable attribute
since files are "categorized" based on extension, hence .exe acting as a
sort of "executable bit".
On Fri, Apr 3, 2009 at 1:36 PM, Shri Borde
<Shri.Borde@microsoft.com<mailto:Shri.Borde@microsoft.com>> wrote:

Anyone know what File.executable? is supposed to do? For me, it always
returns false. For Jim, Tomas and others, it always returns true no
matter what the file extension is. Any idea why we might be getting
different results?



FWIW, the current IronRuby implementation returns true if the file
extension is ".exe".



Thanks,

Shri



From: Shri Borde
Sent: Thursday, April 02, 2009 3:59 PM
To: ruby-core@ruby-lang.org<mailto:ruby-core@ruby-lang.org>
Subject: File.executable? always returns false on Windows machine



On my machine, File.executable? is always returning false. I have tried
1.8p27. I am running on a Windows Vista x86 machine. The file system is
NTFS. I can't think of anything unusual about my machine.



What are the semantic supposed to be? Most of the people I have asked
get a value of true for all of the statements below, even for the
File.executable? on the ttf file.



puts File.exists?("C:/windows/fonts/wingding.ttf")

puts File.readable?("C:/windows/fonts/wingding.ttf")

puts File.executable?("C:/windows/fonts/wingding.ttf") # Prints false
only for me



puts File.exists?("C:/windows/notepad.exe")

puts File.readable?("C:/windows/notepad.exe")

puts File.executable?("C:/windows/notepad.exe") # Prints false only for
me



With the 1.9 binaries, File.executable? returns true only if the file
extensions is something like .exe. Again, it always returns true for the
people I have asked.



Thanks,

Shri
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-04-04 01:00
(Received via mailing list)
Yes, Windows does not have a comparable attribute. However, I can't
figure out how MRI running on Windows implements this since I am getting
a different behavior than what other folks are. IronRuby uses the ".exe"
extension as a sort of "executable bit". Don't know what MRI on Windows
does though. Like I said before, it always returns false for all file
extensions for me. It always returns true for all file extensions for
Jim, Tomas and others.

We need to try to figure out what MRI does, why MRI might be behaving
differently for me, and then use the same logic in IronRuby. Does MRI
honor PATHEXT?

Thanks,
Shri

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Jim Deville
Sent: Friday, April 03, 2009 2:52 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] FW: File.executable? always returns false
on Windows machine

We should probably return true if the extension is in PATHEXT. This
should return true for EXE,COM, CMD, BAT, PS1 (if you have Powershell).
It would be nice if we could inspect whatever assoc touches, so that if
I add an assoc and filetype for RB, it becomes executable.

JD

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Michael
Letterle
Sent: Friday, April 03, 2009 12:04 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] FW: File.executable? always returns false
on Windows machine

On *nix systems it would return true if the executable bit is set and
false if it's not.  Windows doesn't really have a comparable attribute
since files are "categorized" based on extension, hence .exe acting as a
sort of "executable bit".
On Fri, Apr 3, 2009 at 1:36 PM, Shri Borde
<Shri.Borde@microsoft.com<mailto:Shri.Borde@microsoft.com>> wrote:

Anyone know what File.executable? is supposed to do? For me, it always
returns false. For Jim, Tomas and others, it always returns true no
matter what the file extension is. Any idea why we might be getting
different results?



FWIW, the current IronRuby implementation returns true if the file
extension is ".exe".



Thanks,

Shri



From: Shri Borde
Sent: Thursday, April 02, 2009 3:59 PM
To: ruby-core@ruby-lang.org<mailto:ruby-core@ruby-lang.org>
Subject: File.executable? always returns false on Windows machine



On my machine, File.executable? is always returning false. I have tried
1.8p27. I am running on a Windows Vista x86 machine. The file system is
NTFS. I can't think of anything unusual about my machine.



What are the semantic supposed to be? Most of the people I have asked
get a value of true for all of the statements below, even for the
File.executable? on the ttf file.



puts File.exists?("C:/windows/fonts/wingding.ttf")

puts File.readable?("C:/windows/fonts/wingding.ttf")

puts File.executable?("C:/windows/fonts/wingding.ttf") # Prints false
only for me



puts File.exists?("C:/windows/notepad.exe")

puts File.readable?("C:/windows/notepad.exe")

puts File.executable?("C:/windows/notepad.exe") # Prints false only for
me



With the 1.9 binaries, File.executable? returns true only if the file
extensions is something like .exe. Again, it always returns true for the
people I have asked.



Thanks,

Shri
This topic is locked and can not be replied to.