[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] read: unsigned char delim issues
From: |
Chet Ramey |
Subject: |
Re: [PATCH] read: unsigned char delim issues |
Date: |
Wed, 14 Aug 2024 11:44:53 -0400 |
User-agent: |
Mozilla Thunderbird |
On 8/13/24 3:00 PM, Grisha Levit wrote:
The new read_mbchar code is missing an (unsigned char) cast, causing an
invalid continuation byte >0x7F to fail to be recognized as a delimiter
on platforms where char is signed.
$ printf '\317_' | { read -d _; echo "${REPLY@Q}"; }
$'\317'
$ printf '\317\360_' | { read -d $'\360'; echo "${REPLY@Q}"; }
$'\317\360_'
Also, the function cannot distinguish between an ignored delimiter and
a delimiter of 0xFF, since the value is stored as an unsigned char and
the separate ignore_delim flag is not passed along.
Thanks for the report. I agree that changing the delim to an int and
adding casts where necessary is the right fix for this.
This ambiguity affects edit_line as well. Eg. due to a separate issue
(rl_num_chars_to_read treated as a byte, not character count),
Thanks, I fixed this, too.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature