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: Murukesh Mohanan
Subject: Re: Following symlinks in globstar (part 2)
Date: Wed, 11 Apr 2018 15:51:13 +0000

Yep, sorry about that, c.c is selected:

$ bash -c '(shopt -s globstar; d=$(mktemp -d); cd "$d"; mkdir a; ln -s a b;
touch a/a.c c.c; echo **/*.c; cd ..; rm -r "$d")'
a/a.c b/a.c c.c

Is there a chance of having ** not select symlinks to directories, so that
b/c.c doesn't show up in the output?

On Wed, Apr 11, 2018, 23:57 Chet Ramey <address@hidden> 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:
> >>
> >> Before I look at this, note that this doesn't demonstrate anything: you
> >> haven't enabled the `globstar' option, so `**' isn't treated specially.
> >>
> >>> $ bash -c '(d=$(mktemp -d); cd "$d"; mkdir a; ln -s a b; touch a/a.c
> c.c;
> >>> echo **/*.c; cd ..; rm -r "$d")'
> >>> a/a.c b/a.c
> >
> > Here's a possibly more useful demonstration:
> >
> > wooledg:~$ mkdir /tmp/x; cd /tmp/x
> > 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.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/
>
-- 

Muru


reply via email to

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