Project

General

Profile

Actions

Backport #2259

closed

Dir.foreach bug when used with command-line arguments

Added by bev (Benno Evers) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
[ruby-core:26260]

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

Actions #1

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 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

Actions #2

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

Actions

Also available in: Atom PDF

Like0
Like0Like0