opendir(/dev/fd/n) should fail
Helmut Karlowski
helmut.karlowski@ish.de
Fri Jan 23 20:12:00 GMT 2015
--------------------------------------------------
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
More information about the Cygwin
mailing list