Forum: Ruby-core Dir.glob('../*') shows unexpected result in a symbolic linked directory on Windows

8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 unknown (Guest)
on 2014-04-26 09:39
(Received via mailing list)
Issue #9648 has been updated by Usaku NAKAMURA.


 Hi,

 In message "[ruby-core:62170] [ruby-trunk - Bug #9648] Dir.glob('../*')
shows unexpected result in a symbolic linked directory on Windows"
     on Apr.26,2014 16:22:34, <nobu@ruby-lang.org> wrote:
 > 'ok' means it globs as if it is a real directory but not a symlink?

 It's too difficult for me to say it in English.

 C:\foo に V:\ へのsymlinkである bar (つまり C:\foo\bar) を作り、
 そこに chdir した後で Dir.glob('../*') するわけですが、結果は
 期待通り C:\foo の中身(V:\ でなく)を返します。


 > > This problem is only with trunk.
 >
 > It doesn't glob anything, neither the parent of the symlink, or the
target?

 何も返しません。なお、targetである V:\ にはparentが存在しないことは
 留意すべき事項かもしれません。
 ちなみに、targetを適当なディレクトリ V:\baz に変更して実行すると、
 なぜかtrunkでも正しい結果(C:\fooの中身)を返します。


 Regards,
 --
 U.Nakamura <usa@garbagecollect.jp>

----------------------------------------
Bug #9648: Dir.glob('../*') shows unexpected result in a symbolic linked
directory on Windows
https://bugs.ruby-lang.org/issues/9648#change-46328

* Author: Hiroshi Shirosaki
* Status: Feedback
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: ruby 2.2.0dev (2014-03-17 trunk 45356) [x64-mingw32]
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED
----------------------------------------
`Dir.glob('../*')` shows unexpected result if current directory is a
symbolic linked directory on Windows.
This issue seems to be introduced by r44802.

The following is a test case.


~~~
C:\foo>mklink /D bar V:\
symbolic link created for bar <<===>> V:\

C:\foo>cd bar

C:\foo\bar>ruby -ve "p Dir.glob('../*')"
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
["../a", "../bar"]

C:\foo\bar>\rubyinstaller\sandbox\ruby21_build\miniruby.exe -ve "p
Dir.glob('../*')"
ruby 2.2.0dev (2014-02-04 trunk 45356) [x64-mingw32]
[]


C:\foo\bar>dir ..
 Volume in drive C is OS
 Volume Serial Number is 6629-B36B

 Directory of C:\foo

2014/03/17  18:58    <DIR>          .
2014/03/17  18:58    <DIR>          ..
2014/03/17  18:45                 6 a
2014/03/17  18:58    <SYMLINKD>     bar [V:\]
               1 File(s)              6 bytes
               3 Dir(s)  81,915,052,032 bytes free
~~~
This topic is locked and can not be replied to.