Project

General

Profile

This project is closed and read-only.

Actions

Backport #2259

closed

Dir.foreach bug when used with command-line arguments

Backport #2259: Dir.foreach bug when used with command-line arguments

Added by bev (Benno Evers) almost 17 years ago. Updated over 15 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

Also available in: PDF Atom