This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: opendir(/dev/fd/n) should fail
- From: Helmut Karlowski <helmut dot karlowski at ish dot de>
- To: Eric Blake <eblake at redhat dot com>
- Cc: cygwin at cygwin dot com
- Date: Fri, 23 Jan 2015 15:27:04 +0100
- Subject: Re: opendir(/dev/fd/n) should fail
- Authentication-results: sourceware.org; auth=none
- References: <20150123110034 dot B8F3A9F0 dot helmut dot karlowski at ish dot de> <54C254E6 dot 7030408 at redhat dot com>
--------------------------------------------------
Eric Blake <eblake@redhat.com> wrote:
(23/01/2015 15:04)
> 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
I think ksh93 just does not follow synlinks when doing globstar. At
least not the cygwin-version. Guess that's what I'll do as well.
-Helmut
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple