[ruby-core:68129] [Ruby trunk - Feature #4712] File.writable? inaccurate in windows

From: djberg96@...
Date: 2015-02-16 20:05:08 UTC
List: ruby-core #68129
Issue #4712 has been updated by Daniel Berger.


Use win32-file if you want a working File.writable? on Windows.

----------------------------------------
Feature #4712: File.writable? inaccurate in windows
https://bugs.ruby-lang.org/issues/4712#change-51513

* Author: Roger Pack
* Status: Feedback
* Priority: Normal
* Assignee: 
----------------------------------------
Hello. Here's what happens (when a user doesn't have admin privileges in windows 7):

c:\Program Files (x86)\NetBeans 6.9.1>irb --simple-prompt
>> File.writable?('.')
=> true
>> File.writable?('./uninstall.exe')
=> true
>> File.open('./uninstall.exe', 'wb')
Errno::EACCES: Permission denied - ./uninstall.exe
        from (irb):4:in `initialize'
        from (irb):4:in `open'
        from (irb):4

So I think writable was returning true in error here.
Cheers!
-r



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next