Backport #2259
closedDir.foreach bug when used with command-line arguments
Description
=begin
This may be fixed in a newer version, but I couldn't check:
benno@benno-laptop:~/test$ ruby1.9 -v
ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]
benno@benno-laptop:~/test$ ls
äöüß test1.rb test2.rb
benno@benno-laptop:~/test$ cat test1.rb
Dir.foreach(".") {|s| p s }
benno@benno-laptop:~/test$ cat test2.rb
name = ARGV[0]
Dir.foreach(name) {|s| p s }
benno@benno-laptop:~/test$ ruby1.9 test1.rb
"."
".."
"test1.rb"
"test2.rb"
"\xC3\xA4\xC3\xB6\xC3\xBC\xC3\x9F"
benno@benno-laptop:~/test$ ruby1.9 test2.rb .
"."
".."
"test1.rb"
"test2.rb"
test2.rb:2:in foreach': conversion undefined for byte sequence (maybe invalid byte sequence) (RuntimeError) from test2.rb:2:in
'
=end
Updated by matz (Yukihiro Matsumoto) over 14 years ago
=begin
Hi,
In message "Re: [ruby-core:26260] [Bug #2259] Dir.foreach bug when used with command-line arguments"
on Sat, 24 Oct 2009 05:53:43 +0900, Benno Evers redmine@ruby-lang.org writes:
|This may be fixed in a newer version, but I couldn't check:
|benno@benno-laptop:~/test$ ruby1.9 test2.rb .
|"."
|".."
|"test1.rb"
|"test2.rb"
|test2.rb:2:in foreach': conversion undefined for byte sequence (maybe invalid byte sequence) (RuntimeError) | from test2.rb:2:in
'
It doesn't happen on my ruby 1.9.2dev (2009-10-24 trunk 25448) [i686-linux],
so I assume it's fixed.
matz.
=end
Updated by naruse (Yui NARUSE) over 14 years ago
- Status changed from Open to Closed
=begin
Your ruby is 1.9.0, it is not supported now.
This filesystem encoding is implemented in Ruby 1.9.1.
=end