zsh-workers
 help / color / mirror / code / Atom feed
* *$var*/* and recursive globbing
@ 2013-01-26 22:25 Stephane Chazelas
  2013-01-26 22:59 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Chazelas @ 2013-01-26 22:25 UTC (permalink / raw)
  To: Zsh hackers list

Hiya,

With zsh (but also ksh -G and bash -O globstar),

*"$var"*/* where $var is empty, expands like **/* while it
sounds to me like not the right thing to do. It can be worked
around by doing (*"$var"*)/*, but that requires extended_glob.

I would say that's a case where there's a fair chance to break a
perfectly correct POSIX script (considering that **/ is not
disabled in sh emulation).

I would be of the opinion that **/ (and ***/) should recurse only when
entered as is (or at least the two stars entered as is).

What do you think?
-- 
Stephane


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

* Re: *$var*/* and recursive globbing
  2013-01-26 22:25 *$var*/* and recursive globbing Stephane Chazelas
@ 2013-01-26 22:59 ` Bart Schaefer
  2013-01-27 19:04   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2013-01-26 22:59 UTC (permalink / raw)
  To: Zsh hackers list

On Jan 26, 10:25pm, Stephane Chazelas wrote:
} Subject: *$var*/* and recursive globbing
}
} *"$var"*/* where $var is empty, expands like **/*
} 
} I would be of the opinion that **/ (and ***/) should recurse only when
} entered as is (or at least the two stars entered as is).

I tend to agree, but I suspect it's impossible without making ** and ***
into lexical tokens, which might have other unintended consequences (not
to mention a significant ripple effect through the globbing code, turning
this into potentially a large change).


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

* Re: *$var*/* and recursive globbing
  2013-01-26 22:59 ` Bart Schaefer
@ 2013-01-27 19:04   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2013-01-27 19:04 UTC (permalink / raw)
  To: Zsh hackers list

On Sat, 26 Jan 2013 14:59:08 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 26, 10:25pm, Stephane Chazelas wrote:
> } Subject: *$var*/* and recursive globbing
> }
> } *"$var"*/* where $var is empty, expands like **/*
> } 
> } I would be of the opinion that **/ (and ***/) should recurse only when
> } entered as is (or at least the two stars entered as is).
> 
> I tend to agree, but I suspect it's impossible without making ** and ***
> into lexical tokens, which might have other unintended consequences (not
> to mention a significant ripple effect through the globbing code, turning
> this into potentially a large change).

Possibly, though it ought to be doable.

It might also be possible to delay remnulargs(), though it looks like
there are earlier forms of expansion that depend on it, so it doesn't
look very hopeful.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

end of thread, other threads:[~2013-01-27 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-26 22:25 *$var*/* and recursive globbing Stephane Chazelas
2013-01-26 22:59 ` Bart Schaefer
2013-01-27 19:04   ` Peter Stephenson

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).