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

Re: Recent regression on (N) after removing array element



On Tue, 19 Nov 2013 12:08:04 -0500
Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx> wrote:
> This used to work:
> 
> x=( /bin /foo )
> x[(r)/foo]=''
> x=( $^x(N) )
> 
> but the last line now yields an error:
> zsh: no matches found: (N)
> 
> If I remove this recent change to Src/glob.c, (N) works correctly:

What we didn't think of was glob qualifiers that transformed a failed
match in some way.  Although the empty string isn't a valid file name,
it is a valid failed match for a file name.

It's quite hard to see how to improve the test so that we can still
check for something before the (N).  By the time globbing comes along,
it's already been expanded to a bare (N), so we can't see that the user
originally had something in front.

Apart from going back to the original, the only ways round that occur to
me involve reparsing on failure, e.g. reinterpreting as glob qualifiers
if no matches were found.  But that's probably worse than the original
disease.

pws



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