diff options
author | Oliver Kiddle <opk@zsh.org> | 2022-12-17 00:09:37 +0100 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2022-12-17 00:37:19 +0100 |
commit | 35a2f155c3b92e67957325e1f49e409546378e3e (patch) | |
tree | 7c4593cf459ae5067627043c7fba15866c48c8c6 /Test | |
parent | 2701ab161df1f259b8292a650a4ea5cebd668d81 (diff) | |
download | zsh-35a2f155c3b92e67957325e1f49e409546378e3e.tar.gz zsh-35a2f155c3b92e67957325e1f49e409546378e3e.zip |
51214: handle read -d and a delimiter that can't be decoded into a character
Terminate input at the raw byte value of the delimiter.
Also document and test the use of an empty string as a way to specify
NUL as the delimiter.
Diffstat (limited to 'Test')
-rw-r--r-- | Test/B04read.ztst | 4 | ||||
-rw-r--r-- | Test/D07multibyte.ztst | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Test/B04read.ztst b/Test/B04read.ztst index 96adf51c7..14bdaeef5 100644 --- a/Test/B04read.ztst +++ b/Test/B04read.ztst @@ -82,6 +82,10 @@ >Testing the >null hypothesis + read -ed '' <<<$'one\0two' +0:empty delimiter terminates at nulls +>one + print -n $'first line\x80second line\x80' | while read -d $'\x80' line; do print $line; done 0:read with a delimiter >= 0x80 diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst index 6909346cb..413c4fe73 100644 --- a/Test/D07multibyte.ztst +++ b/Test/D07multibyte.ztst @@ -212,6 +212,20 @@ >first >second + read -ed £ +0:read with multibyte delimiter where bytes of delimiter also occur in input +<one¤twoãthree£four +>one¤twoãthree + + read -ed $'\xa0' <<<$'first\xa0second' +0:read delimited by a byte that isn't a valid multibyte character +>first + + read -ed $'\xc2' +0:read delimited by a single byte terminates if the byte is part of a multibyte character +<one£two +>one + (IFS=« read -d » -A array print -l $array) |