Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: path and += troubles



Bart Schaefer wrote:
> Starting from "zsh -f":
> 
> zagzig% setopt cshnullglob
> zagzig% echo $1+=($2)
> zsh: no match
> zagzig% $1+=($2)
> zagzig% 
> 
> The problem of course is that cshnullglob is supposed to be like nomatch
> if *nothing* matches -- it's only supposed to be like nullglob if at
> least one of several patterns matches.

The first argument is globbed separately in order to check whether its
arguments require special expansion, via a direct call to zglob() rather
than globlist() which is where cshnullglob is handled.  Even if the flag
had been set, if globlist() were later called for other arguments the
flag would be reset.

Does applying cshnullglob to the command word and its argument list
together make sense?  It would mean you were happy for any of the
expansions to give you the command to run.  I suppose that's just
conceivable.  This would need fixing up around execcmd() by separating
out the cshnullglob handling from globlist(), though we still need the
current form of handling in globlist() for other uses like array
assignments... not very pretty.

> I originally [in the -users thread] mentioned that the error message
> vanishes with either nullglob or cshnullglob.  After I figured out that
> it happens because the test string I was using was somehow a valid glob
> qualifier -- that is, "(2)" is a valid qualifier, though I have no idea
> what meaning it can possibly have -- then I said [on -workers] that it
> was limited to cshnullglob.

Looks like it means an octal mode: try *(644).  I have no idea where
this came from; it doesn't appear to be documented.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



Messages sorted by: Reverse Date, Date, Thread, Author