bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Following symlinks in globstar (part 2)


From: Ilkka Virta
Subject: Re: Following symlinks in globstar (part 2)
Date: Wed, 11 Apr 2018 18:16:19 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 11.4. 17:57, Chet Ramey wrote:
On 4/11/18 10:32 AM, Greg Wooledge wrote:
On Wed, Apr 11, 2018 at 10:21:03AM -0400, Chet Ramey wrote:
On 4/11/18 12:21 AM, Murukesh Mohanan wrote:
This has come up in the past, and was somewhat resolved (<
http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00097.html>), but
bash's behaviour is still a but surprising IMHO. While globstar doesn't
descend further into symlinks, symlinked directories are selected as a
candidate for matches to ** itself. But zsh doesn't do this:

wooledg:/tmp/x$ mkdir dir; ln -s dir link; touch dir/file
wooledg:/tmp/x$ shopt -s globstar
wooledg:/tmp/x$ echo **
dir dir/file link
wooledg:/tmp/x$ echo **/file
dir/file link/file

I think the complaint is about the handling of "**/file" here.

Yep, that's an incompatibility. The `c.c' thing in the original report is
just a red herring, though.

So, given

.
|-- dir
|   +-- link -> ../otherdir
+-- otherdir
    +-- subdir
        +-- foo

(that is: mkdir -p dir otherdir/subdir; ln -s ../otherdir dir/link; touch otherdir/subdir/foo )

dir/**/foo does not match anything, but dir/**/subdir matches dir/link/subdir , i.e. ** looks through the link, but doesn't recurse through it? Did I get that right?

That does seem somewhat surprising. The documentation on globstar doesn't seem to mention anything about behaviour re. symlinks either.

--
Ilkka Virta / itvirta@iki.fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]