Feature #2408

better error reporting in windows when you try to run a directory

Added by Roger Pack over 5 years ago. Updated about 3 years ago.

[ruby-core:26925]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada

Description

=begin
Currently in linux, you may get this:

$ ruby -c wbo_backup
ruby: Is a directory - wbo_backup (Errno::EISDIR)

however we are not so fortunate in windows

C:\dev\ruby\p2pwebclient\documents\writeup\final>ruby logs
ruby: Permission denied -- logs (LoadError)

It would be nice to get a similar error message in windows.

Thanks!
-r
=end

Associated revisions

Revision 35131
Added by Nobuyoshi Nakada about 3 years ago

  • ruby.c (load_file_internal): bail out if the script is a directory. [Feature #2408]

Revision 35131
Added by Nobuyoshi Nakada about 3 years ago

  • ruby.c (load_file_internal): bail out if the script is a directory. [Feature #2408]

Revision 35134
Added by Nobuyoshi Nakada about 3 years ago

  • win32/win32.c (check_if_dir, check_if_wdir): fix for Visual C++ not to use S_ISDIR(). [Feature #2408]
  • ruby.c (load_file_internal): ditto.

Revision 35134
Added by Nobuyoshi Nakada about 3 years ago

  • win32/win32.c (check_if_dir, check_if_wdir): fix for Visual C++ not to use S_ISDIR(). [Feature #2408]
  • ruby.c (load_file_internal): ditto.

History

#1 Updated by Vladimir Sizikov over 5 years ago

=begin
Yeah, all MRI versions from 1.8.6, through 1.8.7, 1.9.0, 1.9.1, 1.9.2-dev, all report "Permission denied" on Windows. Except for cygwin ruby :) Actually, even JRuby reports Permission denied.

This difference between platforms is indeed unfortunate.
=end

#2 Updated by ujihisa . over 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to Usaku NAKAMURA

=begin

=end

#3 Updated by Usaku NAKAMURA over 5 years ago

  • Status changed from Assigned to Open
  • Assignee deleted (Usaku NAKAMURA)

=begin
On some platforms which allow to read directory entry, such errors occurs.

% ruby18 tmp
tmp:1: Invalid char \027' in expression
tmp:1: Invalid char
\001' in expression
% ruby19 tmp
tmp:1: Invalid char \x17' in expression
tmp:1: Invalid char
\x01' in expression
tmp:1:in <main>': undefined local variable or methodxy' for main:Object (NameError)

So, this is not Windows issue.
=end

#4 Updated by Kazuhiro NISHIYAMA almost 5 years ago

  • Category set to core
  • Target version set to 2.0.0

=begin

=end

#5 Updated by Yusuke Endoh about 3 years ago

  • Description updated (diff)
  • Assignee set to Nobuyoshi Nakada

#6 Updated by Nobuyoshi Nakada about 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r35131.
Roger, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ruby.c (load_file_internal): bail out if the script is a directory. [Feature #2408]

Also available in: Atom PDF