Forum: Ruby-core [CommonRuby - Feature #7596][Open] Find::find should not silently ignores errors

Posted by hoylen (Hoylen Sue) (Guest)
on 2012-12-21 08:07
(Received via mailing list)
Issue #7596 has been reported by hoylen (Hoylen Sue).

----------------------------------------
Feature #7596: Find::find should not silently ignores errors
https://bugs.ruby-lang.org/issues/7596

Author: hoylen (Hoylen Sue)
Status: Open
Priority: Low
Assignee:
Category:
Target version:


=begin
The current implementation of (({Find::find})) silently ignores errors. 
It deliberately catches a number of (({Errno::*})) errors and just 
continues processing. This can cause unexpected (and often unnoticed) 
results when, for example, unreadable directories are encountered. Find 
will not recurse into those directories, but does also not tell the user 
that it is skipping them and their contents. This happened to me when 
there was a directory owned by another user.

I suggest making the default behaviour to ((*not*)) ignore errors. But 
then provide an ((*option*)) for the caller to indicate that they want 
(({find})) to keep going if it encounters some types of errors. This way 
the caller has control and the default behaviour is the one with "least 
surprise" for the caller.


Either that, or at least change the documentation to point out that the 
current implementation silently ignores errors and unreadable 
directories. That way the caller will know the limitations of the 
method.

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/find/r...

When updating the documentation, it would also be useful for 
documentation for the "Find" module's "find" class method to also point 
out that:

"The associated block is never called with "." or "..", except when they 
are explicitly provided as one of the arguments."

You can check this behavour by trying out different values for 
"testdirname" in the following command

  ruby -e 'require "find"; Find.find(ARGV[0]) { |d| puts "<#{d}>" }' 
testdirname


=end
Posted by drbrain (Eric Hodel) (Guest)
on 2013-01-25 22:37
(Received via mailing list)
Issue #7596 has been updated by drbrain (Eric Hodel).

Category set to lib
Target version set to next minor


----------------------------------------
Feature #7596: Find::find should not silently ignores errors
https://bugs.ruby-lang.org/issues/7596#change-35642

Author: hoylen (Hoylen Sue)
Status: Open
Priority: Low
Assignee:
Category: lib
Target version: next minor


=begin
The current implementation of (({Find::find})) silently ignores errors. 
It deliberately catches a number of (({Errno::*})) errors and just 
continues processing. This can cause unexpected (and often unnoticed) 
results when, for example, unreadable directories are encountered. Find 
will not recurse into those directories, but does also not tell the user 
that it is skipping them and their contents. This happened to me when 
there was a directory owned by another user.

I suggest making the default behaviour to ((*not*)) ignore errors. But 
then provide an ((*option*)) for the caller to indicate that they want 
(({find})) to keep going if it encounters some types of errors. This way 
the caller has control and the default behaviour is the one with "least 
surprise" for the caller.


Either that, or at least change the documentation to point out that the 
current implementation silently ignores errors and unreadable 
directories. That way the caller will know the limitations of the 
method.

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/find/r...

When updating the documentation, it would also be useful for 
documentation for the "Find" module's "find" class method to also point 
out that:

"The associated block is never called with "." or "..", except when they 
are explicitly provided as one of the arguments."

You can check this behavour by trying out different values for 
"testdirname" in the following command

  ruby -e 'require "find"; Find.find(ARGV[0]) { |d| puts "<#{d}>" }' 
testdirname


=end
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-02-22 01:17
(Received via mailing list)
Issue #7596 has been updated by ko1 (Koichi Sasada).

Assignee set to matz (Yukihiro Matsumoto)

I'm not sure who can grab this ticket.
So I assign it to matz.

----------------------------------------
Feature #7596: Find::find should not silently ignores errors
https://bugs.ruby-lang.org/issues/7596#change-36743

Author: hoylen (Hoylen Sue)
Status: Open
Priority: Low
Assignee: matz (Yukihiro Matsumoto)
Category: lib
Target version: next minor


=begin
The current implementation of (({Find::find})) silently ignores errors. 
It deliberately catches a number of (({Errno::*})) errors and just 
continues processing. This can cause unexpected (and often unnoticed) 
results when, for example, unreadable directories are encountered. Find 
will not recurse into those directories, but does also not tell the user 
that it is skipping them and their contents. This happened to me when 
there was a directory owned by another user.

I suggest making the default behaviour to ((*not*)) ignore errors. But 
then provide an ((*option*)) for the caller to indicate that they want 
(({find})) to keep going if it encounters some types of errors. This way 
the caller has control and the default behaviour is the one with "least 
surprise" for the caller.


Either that, or at least change the documentation to point out that the 
current implementation silently ignores errors and unreadable 
directories. That way the caller will know the limitations of the 
method.

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/find/r...

When updating the documentation, it would also be useful for 
documentation for the "Find" module's "find" class method to also point 
out that:

"The associated block is never called with "." or "..", except when they 
are explicitly provided as one of the arguments."

You can check this behavour by trying out different values for 
"testdirname" in the following command

  ruby -e 'require "find"; Find.find(ARGV[0]) { |d| puts "<#{d}>" }' 
testdirname


=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.