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

Re: (LC_ALL=C; set -x 128 129; printf "%s\n" ${(#)@} | hexdump -C)

> On 08/09/2023 17:30 Jun. T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> > 2023/09/08 1:33, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > 
> > Looks like these are the only calls to substevalchar(), so perhaps
> > the changes could be made internal to that.
> I changed paramsubst() just because we can assume errflag=0 at the
> start of the block (and would make the things simpler.).
> But, anyway, my previous patch was not complete.
> Either with or without my previous patch (in any locale):
> % echo ${(#X):-@}
> zsh: bad math expression: illegal character: @
> This is OK. But:
> % printf "%s\n" ${(#):-@} | hexdump -C 
> 00000000  22 0a 22                                          |"."|
> 00000003
> The quote removal is done in remnulargs() ( at subst.c:169).
> So it seems that if noerrs is set (without (X) flag) then we should not
> quit from prefork() at line 146. This means, I guess, substevalchar()
> should not return NULL if noerrs is set. But if we want to continue
> even if we have a bad math expression, only thing we can do is just
> to return "" instead of NULL. The patch below (hopefuly) does this.
> Any comment is welcome.

I think that's fine --- it's the sort of thing where we'll only find
out if there are issues when someone comes up with a new corner case.


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