This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: opendir(/dev/fd/n) should fail


On 01/23/2015 03:00 AM, Helmut Karlowski wrote:
> 
> --------------------------------------------------
> Helmut Karlowski <helmut.karlowski@ish.de> wrote:
> (23/01/2015 10:54)
>>
>> It's not just bash. The same happens in my home-grown shell. Starting 
>> with /dev/fd/3 opendir succeeds giving (only the opendir-entries):
> 
> Maybe it's because:
> 
> 3 -> /proc/3008/fd/
> 
> which recurses into /dev/fd again?

Yep. You'd get similar behavior for:

ln -s . dot

then trying to do a recursive listing of ./dot/**

Without some form of symlink recursion detection (aka "have we seen the
inode of this directory higher up in the tree?"), this will affect any
symlink-to-directory hierarchy loop.  Might be worth reporting it
upstream to see if bash is willing to add an inode hash table to prevent
infinite recursion on ** expansions across symlink loops, but as it is
not a cygwin-specific issue, I'm not going to try and do anything about
it downstream in the cygwin build of bash.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]