Project

General

Profile

Actions

Bug #8597

closed

Unexpected result of Dir.glob of '<' or '>' on Windows

Added by phasis68 (Heesob Park) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-07-02 trunk 41732) [i386-mswin32_100]
[ruby-core:55764]

Description

I have found the following results of Dir.glob when containing '<' or '>' on path.

C:\Users\phasis>irb
irb(main):001:0> Dir.glob('>')
=> [">"]
irb(main):002:0> Dir.glob('<')
=> ["<"]
irb(main):003:0> Dir.glob('>><<>><<')
=> [">><<>><<"]
irb(main):004:0> Dir.glob('>>.<<')
=> [">>.<<"]
irb(main):005:0> Dir.glob('<><>.<><>')
=> ["<><>.<><>"]
irb(main):006:0> Dir.glob('a<<<')
=> ["a<<<"]
irb(main):007:0> Dir.glob('.<<<')
=> [".<<<"]
irb(main):008:0> Dir.glob('>>.rb')
=> [">>.rb"]

These results are due to a bug of stat function of Windows.

I think it would be better to raise Invalid argument error like File.stat.

irb(main):010:0> File.stat('>>.rb')
Errno::EINVAL: Invalid argument @ rb_file_s_stat - >>.rb
from (irb):10:in stat' from (irb):10 from c:/usr/bin/irb.bat:18:in '

Actions

Also available in: Atom PDF

Like0
Like0