zsh-workers
 help / color / mirror / code / Atom feed
* Bug? Unexpected globbing duplicates
@ 2022-02-12 20:31 andykluger
  2022-02-12 23:31 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: andykluger @ 2022-02-12 20:31 UTC (permalink / raw)
  To: zsh-workers

Hello!

I encountered a surprising result while using a glob expression, with
extended globs enabled, of duplicate resulting elements, where the
number of duplicates is proportional to the filesystem depth of that
result.

The expression I first observed this with pointlessly combines **/***/:

% vids=((#i)**/***/*(.mp4)(#q.))

Simply demonstrated, without extendedglob or qualifiers or flags:

% mkdir -p foo/bar/baz
% print -rl -- **/***/*

foo
foo/bar
foo/bar
foo/bar/baz
foo/bar/baz
foo/bar/baz

And thanks to danielsh and dana for pointing out, with **/**/:

% print -rl -- **/**/*

foo
foo/bar
foo/bar
foo/bar/baz
foo/bar/baz
foo/bar/baz

I know now there's no reason to have the extra leading **/ in either
case, and this problem does not present when done properly like that.

Thanks for reading,
Andy


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-12 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-12 20:31 Bug? Unexpected globbing duplicates andykluger
2022-02-12 23:31 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).