[Top][All Lists]

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

Following symlinks in globstar (part 2)

From: Murukesh Mohanan
Subject: Following symlinks in globstar (part 2)
Date: Wed, 11 Apr 2018 04:21:08 +0000

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:

$ 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
$ zsh -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 c.c

I would strongly prefer zsh's behaviour here:
- files in symlinked directories are not selected, so that I don't get
duplicate files, which was one of the original complaints
- additionally, unrelated to the symlink problem, files in current
directory are also selected in **/foo (so that ** is "zero or more
subdirectories" even when followed by /)

I'm not sure whether this qualifies as a bug, the docs AFAICT don't clarify
what should happen.


reply via email to

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