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

Re: Metafication in error messages (Was: [PATCH] unmetafy Re: $var not expanded in ${x?$var})



On Wed, Feb 21, 2024 at 11:55 PM Stephane Chazelas
<stephane@xxxxxxxxxxxx> wrote:
>
> 2024-02-22 07:23:13 +0000, Stephane Chazelas:
> > 2024-02-21 16:46:23 -0800, Bart Schaefer:
> > [...]
> > >     Code    Argument types          Prints
> > >     %s      const char *            C string (null terminated)
> > > +   %S      const char *            C string (null terminated), output raw
> >
> > May be worth pointing out there that the string is expected to
> > be metafied (for both %s and %S).

Actually the string is NOT really expected to be metafied ... usually
it's a plain string hardwired in the calling code, so the caller
actually should have the responsibility for unmetafy.  In the
particular case of %l --

> > >     %l      const char *, int       C string of given length (null not required)
> >
> > Would that one be expected to be metafied?
>
> I see it used in this error message:
>
> $ printf '%d\n' $'1+|a\x83 c'
> zsh: bad math expression: operand expected at `|a^@c'

-- there's no (or not presently) any version of unmetafy that works
without nul-termination.




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