bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] _rl_untranslate_macro_value with meta control chars


From: Grisha Levit
Subject: Re: [PATCH] _rl_untranslate_macro_value with meta control chars
Date: Thu, 3 Aug 2023 15:52:21 -0400

Hey Branden,

On Thu, Aug 3, 2023 at 10:03 AM G. Branden Robinson
<g.branden.robinson@gmail.com> wrote:
>
> Hi Grisha,
>
> At 2023-08-03T06:24:25-0400, Grisha Levit wrote:
> > $ bind '"2PI": "ππ"'; bind -s
> > "2PI": "\M-O\M-"
>
> I think the canonical way to represent a null byte (or, in this case, a
> null bit septet within a byte) with this notation is ^@.  And that is in
> fact what I see.
> [...]
> > bind -s | cat -v
> "2PI": "M-OM-^@M-OM-^@"

Thanks for mentioning it, this difference in behavior is maybe actually
the better place for me to have started the report from.

Note that my output for the "PI" cases was not piped through `cat -v',
nor otherwise translated for email  -- that was the literal text being
written by `bind -s'.  I'm assuming your output (without `cat -v') had
actual `π' characters.

The output actually depends on the signedness of char on your platform:

$ uname -sp
Linux aarch64
$ getconf CHAR_MAX
255
$ (bind '"PI": "π"'; bind -s)
"PI": "\M-O\M-"

$ uname -sp
Linux x86_64
$ getconf CHAR_MAX
127
$ (bind '"PI": "π"'; bind -s)
"PI": "π"

I suspect the behavior difference is not intentional.  The code seems to
have been written with the goal of producing output without the high bit
set so is missing some `(unsigned char)' casts.  Alternatively, the `M-'
prefixing can be done in some locale-aware away.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]