From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Metafication in error messages (Was: [PATCH] unmetafy Re: $var not expanded in ${x?$var})
Date: Thu, 22 Feb 2024 14:31:12 -0800 [thread overview]
Message-ID: <CAH+w=7YcXGPDNFaGA_onRnRmWPhrZ3ems5x_9amEaH8y2miWSA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Z5CELddo2qJtiNWM2AmxkRoqKz3Pj9LdEGb1z_3SyqeQ@mail.gmail.com>
On Thu, Feb 22, 2024 at 9:07 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> However, per commentary in the other thread, I'm going to recommend
> against using this patch in the first place. We need to rethink this
> whole approach.
On Thu, Feb 22, 2024 at 9:02 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> Actually the string is NOT really expected to be metafied
... in fact, %l allocates space for it to be metafied during output.
> ... usually it's a plain string hardwired in the calling code
Curiously, the only existing uses of %l are for strings that came from
user input (arithmetic or a history reference) so they're almost
certainly already metafied.
So ... one possible approach is to declare that %l is the way to
produce "raw" output, and have it perform the unmetafy() + fwrite().
However, it's not clear to me that's preferred in Stephane's examples
like this one:
> > $ printf '%d\n' $'1+|a\x83 c'
> > zsh: bad math expression: operand expected at `|a^@c'
Do we really want to "see" a raw \x83 there? No one would
intentionally use a math syntax error e.g. to produce terminal control
sequences.
> the caller actually should have the responsibility for unmetafy.
Another possibility therefore is to to have %l do raw output but NOT
unmetafy(), so the caller would need to either unmetafy() and pass a
length, or nicedup() the string when that was the desired output
(which handles the unmetafy() internally, and nul-terminates).
The final option would be to leave %l alone and add %S with a length
argument ... but I don't see that as much better than the foregoing,
given the very limited use of %l so far.
Opinions?
next prev parent reply other threads:[~2024-02-22 22:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 8:02 $var not expanded in ${x?$var} Stephane Chazelas
2023-01-16 8:35 ` Daniel Shahaf
2023-01-16 17:15 ` Peter Stephenson
2024-02-20 7:05 ` Stephane Chazelas
2024-02-20 17:45 ` Bart Schaefer
2024-02-20 19:39 ` Stephane Chazelas
2024-02-21 4:44 ` Bart Schaefer
2024-02-21 19:45 ` Stephane Chazelas
2024-02-21 19:52 ` Bart Schaefer
2024-02-21 20:21 ` Stephane Chazelas
2024-02-22 0:46 ` [PATCH] unmetafy " Bart Schaefer
2024-02-22 7:23 ` Stephane Chazelas
2024-02-22 7:55 ` Metafication in error messages (Was: [PATCH] unmetafy Re: $var not expanded in ${x?$var}) Stephane Chazelas
2024-02-22 17:02 ` Bart Schaefer
2024-02-22 22:31 ` Bart Schaefer [this message]
2024-02-23 0:49 ` Bart Schaefer
2024-02-23 19:27 ` Stephane Chazelas
2024-02-23 22:32 ` Bart Schaefer
2024-02-23 23:38 ` Bart Schaefer
2024-02-24 9:47 ` Stephane Chazelas
2024-02-24 10:36 ` Stephane Chazelas
2024-02-25 4:35 ` [PATCH] 'bad interpreter' error garbled Bart Schaefer
2024-02-25 5:26 ` Bart Schaefer
2024-02-25 2:17 ` Metafication in error messages (Was: [PATCH] unmetafy Re: $var not expanded in ${x?$var}) Bart Schaefer
2024-02-25 6:05 ` Bart Schaefer
2024-02-25 7:29 ` Stephane Chazelas
2024-02-25 8:28 ` typeset -<non-ASCII> (Was: metafication in error messages) Stephane Chazelas
2024-02-25 8:35 ` Stephane Chazelas
2024-02-25 21:02 ` Bart Schaefer
2024-02-23 0:33 ` Metafication in error messages (Was: [PATCH] unmetafy Re: $var not expanded in ${x?$var}) Bart Schaefer
2024-02-25 5:06 ` [PATCH] count multibyte and metafied characters correctly for math ops errors Bart Schaefer
2024-02-22 8:34 ` [PATCH] unmetafy Re: $var not expanded in ${x?$var} Roman Perepelitsa
2024-02-22 17:07 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7YcXGPDNFaGA_onRnRmWPhrZ3ems5x_9amEaH8y2miWSA@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).