Feature #2408

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

Added by rogerdpack (Roger Pack) over 2 years ago. Updated about 1 month ago.

[ruby-core:26925]
Status:Closed Start date:11/28/2009
Priority:Normal Due date:
Assignee:nobu (Nobuyoshi Nakada) % Done:

100%

Category:core
Target version:2.0.0

Description

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

Associated revisions

Revision 35131
Added by nobu (Nobuyoshi Nakada) about 1 month ago

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

Revision 35134
Added by nobu (Nobuyoshi Nakada) about 1 month ago

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

History

Updated by vvs (Vladimir Sizikov) over 2 years ago

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.

Updated by ujihisa (ujihisa .) over 2 years ago

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

Updated by usa (Usaku NAKAMURA) over 2 years ago

  • Status changed from Assigned to Open
  • Assignee deleted (usa (Usaku NAKAMURA))
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 method `xy' for main:Object (NameError)

So, this is not Windows issue.

Updated by znz (Kazuhiro NISHIYAMA) about 2 years ago

  • Category set to core
  • Target version set to 2.0.0

Updated by mame (Yusuke Endoh) about 1 month ago

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

Updated by nobu (Nobuyoshi Nakada) about 1 month 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][ruby-core:26925]

Also available in: Atom PDF