ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:81467] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
@ 2017-05-30 11:25 ` sonots
  2017-05-31  0:45 ` [ruby-core:81477] [Ruby trunk Feature#13613][Feedback] " shyouhei
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: sonots @ 2017-05-30 11:25 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been reported by sonots (Naotoshi Seo).

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613

* Author: sonots (Naotoshi Seo)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81477] [Ruby trunk Feature#13613][Feedback] Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
  2017-05-30 11:25 ` [ruby-core:81467] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable sonots
@ 2017-05-31  0:45 ` shyouhei
  2017-05-31  1:08 ` [ruby-core:81478] [Ruby trunk Feature#13613] " sonots
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: shyouhei @ 2017-05-31  0:45 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by shyouhei (Shyouhei Urabe).

Status changed from Open to Feedback

There's no such think like PermissionError.  Do you want to introduce one?
Or perhaps you mean Errno::EPERM? Then it sounds slightly odd to me, because other Errno errors such as Errno::ENOENT can be thought of.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65185

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81478] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
  2017-05-30 11:25 ` [ruby-core:81467] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable sonots
  2017-05-31  0:45 ` [ruby-core:81477] [Ruby trunk Feature#13613][Feedback] " shyouhei
@ 2017-05-31  1:08 ` sonots
  2017-05-31  2:00 ` [ruby-core:81479] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error " sonots
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: sonots @ 2017-05-31  1:08 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by sonots (Naotoshi Seo).


> you mean Errno::EPERM?
Ah, yes

> other Errno errors such as Errno::ENOENT can be thought of.
Right, I think other errno also should be given.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65186

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81479] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2017-05-31  1:08 ` [ruby-core:81478] [Ruby trunk Feature#13613] " sonots
@ 2017-05-31  2:00 ` sonots
  2017-05-31  2:05 ` [ruby-core:81480] " shyouhei
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: sonots @ 2017-05-31  2:00 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by sonots (Naotoshi Seo).


I am thinking to apply a patch like:

```
diff --git a/load.c b/load.c
index 75ac4df..a8175ca 100644
--- a/load.c
+++ b/load.c
@@ -708,7 +708,7 @@ rb_f_load(int argc, VALUE *argv)
     path = rb_find_file(fname);
     if (!path) {
        if (!rb_file_load_ok(RSTRING_PTR(fname)))
-           load_failed(orig_fname);
+           rb_load_fail(orig_fname, strerror(errno));
        path = fname;
     }
     rb_load_internal(path, RTEST(wrap));
@@ -1049,7 +1049,7 @@ rb_require_safe(VALUE fname, int safe)
        JUMP_TAG(result);
     }
     if (result < 0) {
-       load_failed(fname);
+       rb_load_fail(fname, strerror(errno));
     }

     return result ? Qtrue : Qfalse;
```

However, it was not sufficient because `require 'foo'` first tries to load `foo.rb`, and if it does not exist or not readable, load `foo.so` next.
So, we get ENOENT in errno although I want to get EACCESS in this situation.

Any advice is welcome.


----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65188

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [ruby-core:81480] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2017-05-31  2:00 ` [ruby-core:81479] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error " sonots
@ 2017-05-31  2:05 ` shyouhei
  2017-05-31  2:07 ` [ruby-core:81481] " sonots
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: shyouhei @ 2017-05-31  2:05 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by shyouhei (Shyouhei Urabe).


Mmm, this is my private feeling but it seems introducing whole Errno::Efoobar set into require seems to be a drastic change.  If we do such change, a formely-legal script like this:

```ruby
begin
  require 'foo'
rescue LoadError
  puts 'cannot load such file'
end
```

should then be rewritten as:

```ruby
begin
  require 'foo'
rescue Errno::ENOENT
  puts 'no such file or directory'
rescue Errno::EISDIR
  puts 'is a directory'
rescue Errno::EACCESS
  puts 'access denied'
rescue Errno::ELOOP
  puts 'too many levels of symbolic links'
rescue ...
  ...
end
```

And it's quite annoying.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65189

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81481] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2017-05-31  2:05 ` [ruby-core:81480] " shyouhei
@ 2017-05-31  2:07 ` sonots
  2017-05-31  2:11 ` [ruby-core:81482] " shyouhei
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: sonots @ 2017-05-31  2:07 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by sonots (Naotoshi Seo).


It is not correct. The error class is still LoadError, only error message is changed.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65190

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81482] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2017-05-31  2:07 ` [ruby-core:81481] " sonots
@ 2017-05-31  2:11 ` shyouhei
  2017-05-31  9:35 ` [ruby-core:81485] " shevegen
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: shyouhei @ 2017-05-31  2:11 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by shyouhei (Shyouhei Urabe).


sonots (Naotoshi Seo) wrote:
> It is not correct. The error class is still LoadError, only error message is changed.

OK, I see what you want.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65191

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81485] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2017-05-31  2:11 ` [ruby-core:81482] " shyouhei
@ 2017-05-31  9:35 ` shevegen
  2017-06-01  4:04 ` [ruby-core:81497] " nobu
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: shevegen @ 2017-05-31  9:35 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by shevegen (Robert A. Heiler).


Would be nice - the better error messages are, the easier it may be to solve problems related
from that. We had the did_you_mean gem from Yuki Nishijima, perhaps we will one day have a 
do_you_want_to_fix_this_problem_that_way, like in a circular require warning or rubuocop
autocorrection method. :D

So I think the more accurate error messages are, the better.

IMO an error such as "Permission denied" is better than the error "cannot load such file",
even though the latter may be the more correct one from a technical point of view.

If necessary one could always slightly extend the error in the latter case such as
"cannot load such file - permission denied" or something like that.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65193

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:81497] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2017-05-31  9:35 ` [ruby-core:81485] " shevegen
@ 2017-06-01  4:04 ` nobu
  2017-08-30 10:07 ` [ruby-core:82532] " sonots
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: nobu @ 2017-06-01  4:04 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by nobu (Nobuyoshi Nakada).


`require` searches a library across load paths.
When many unreadable files matched, do you want all of them to be reported?
I think it would not make sense unless reporting the full path name.
Maybe warnings for existent but unloadable files?

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-65207

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:82532] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (8 preceding siblings ...)
  2017-06-01  4:04 ` [ruby-core:81497] " nobu
@ 2017-08-30 10:07 ` sonots
  2017-09-22  5:42 ` [ruby-core:82931] " sonots
  2017-09-25 12:16 ` [ruby-core:82987] " shyouhei
  11 siblings, 0 replies; 12+ messages in thread
From: sonots @ 2017-08-30 10:07 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by sonots (Naotoshi Seo).


I propose following specification:


If ENOENT occurs for all paths searched, raise LoadError with messages like below:

```
in `require': cannot load such file -- No such file or directory -- foobar (LoadError)
```

If other errors such as EACCESS are detected, stop searching any more and raise LoadError at that timing with messages like below:

```
in `require': cannot load such file -- Permission denied -- foobar (LoadError)
```

(`Permission denied`is just an example for EACCESS)


----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-66342

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:82931] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (9 preceding siblings ...)
  2017-08-30 10:07 ` [ruby-core:82532] " sonots
@ 2017-09-22  5:42 ` sonots
  2017-09-25 12:16 ` [ruby-core:82987] " shyouhei
  11 siblings, 0 replies; 12+ messages in thread
From: sonots @ 2017-09-22  5:42 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by sonots (Naotoshi Seo).


I tried to write a patch which just adding `strerror(errno)` to error message. 
https://github.com/sonots/ruby/commit/4af8960b65aec1c4a82d81431ed812bcebcdf7f8

But, I noticed that it was very fragile.

```
$:.replace([IO::NULL])
require 'foo'
```

This tells `cannot load such file -- Not a directory -- foo (LoadError)` rather than `cannot load such file -- No such file or directory -- foo (LoadError)`.
The error message depends on orders of calling syscalls internally, which is very fragile.


----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-66832

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:82987] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
       [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
                   ` (10 preceding siblings ...)
  2017-09-22  5:42 ` [ruby-core:82931] " sonots
@ 2017-09-25 12:16 ` shyouhei
  11 siblings, 0 replies; 12+ messages in thread
From: shyouhei @ 2017-09-25 12:16 UTC (permalink / raw
  To: ruby-core

Issue #13613 has been updated by shyouhei (Shyouhei Urabe).


We looked at this issue in a developer meeting today.  It seems we need to define "fatality" of each situations for requiring a library.  For instance, ENOENT seems less fatal than EACCESS.  For ENOENT situation we can silently ignore the error and continue searching in the next LOAD_PATH. However on EACCESS (which means there do exist a file but not readable), it might be worth raising exceptions.

We did not reach consensus whether we should raise then, or to just print warning and continue searching.

----------------------------------------
Feature #13613: Prefer that require/require_relative/load to tell us permission error if the target file is unreadable
https://bugs.ruby-lang.org/issues/13613#change-66895

* Author: sonots (Naotoshi Seo)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
### Background

https://github.com/google/google-api-ruby-client/issues/205

We've ever met a situation that read-permissions of files in released google-api-client gem were lost as:

```
$ ls -l ~/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/google-api-client-0.8.3/lib/google
-rw-r----- 1 sonots sonots 27249  March 24 18:32 2015 api_client.rb
```

The error message was

```
in `require': cannot load such file -- api_client.rb (LoadError)
```

At that time, it took 30 minutes for me to find the reason why we get LoadError with the gem because the file exists.
I looked the source codes load.c, and finally I found the reason as it is because of permission with my intuition.

### What I Want

If `require` tells us PermissionError in addition to LoadError, I could figure out the reason soon.
I think the additional information is helpful for finding such issues.





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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-09-25 12:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-13613.20170530112533@ruby-lang.org>
2017-05-30 11:25 ` [ruby-core:81467] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us PermissionError if the target file is unreadable sonots
2017-05-31  0:45 ` [ruby-core:81477] [Ruby trunk Feature#13613][Feedback] " shyouhei
2017-05-31  1:08 ` [ruby-core:81478] [Ruby trunk Feature#13613] " sonots
2017-05-31  2:00 ` [ruby-core:81479] [Ruby trunk Feature#13613] Prefer that require/require_relative/load to tell us permission error " sonots
2017-05-31  2:05 ` [ruby-core:81480] " shyouhei
2017-05-31  2:07 ` [ruby-core:81481] " sonots
2017-05-31  2:11 ` [ruby-core:81482] " shyouhei
2017-05-31  9:35 ` [ruby-core:81485] " shevegen
2017-06-01  4:04 ` [ruby-core:81497] " nobu
2017-08-30 10:07 ` [ruby-core:82532] " sonots
2017-09-22  5:42 ` [ruby-core:82931] " sonots
2017-09-25 12:16 ` [ruby-core:82987] " shyouhei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).