[ruby-dev:49497] [Ruby trunk Bug#12087] Find.find に存在しないパスを渡した時のエラーにパス名がない

From: tommy@...
Date: 2016-02-19 09:08:40 UTC
List: ruby-dev #49497
Issue #12087 has been reported by Masahiro Tomita.

----------------------------------------
Bug #12087: Find.find に存在しないパスを渡した時のエラーにパス名がない
https://bugs.ruby-lang.org/issues/12087

* Author: Masahiro Tomita
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
`ruby -rfind -e 'Find.find("/hoge"){}'` で /hoge が存在しない場合に発生するエラーが `No such file or directory (Errno::ENOENT)` でパス名が含まれてません。

エラーにパス名を含めて欲しいです。次の修正で `No such file or directory - /hoge (Errno::ENOENT)` となります。

```diff
diff --git a/lib/find.rb b/lib/find.rb
index aa7a3c0..093f855 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -41,5 +41,5 @@ def find(*paths, ignore_error: true) # :yield: path
     fs_encoding = Encoding.find("filesystem")
 
-    paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path|
+    paths.collect!{|d| raise Errno::ENOENT, d unless File.exist?(d); d.dup}.each do |path|
       path = path.to_path if path.respond_to? :to_path
       enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding
```



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

In This Thread

Prev Next