zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: [bug] busy loop and memory exhaustion on {x..$'\80'} with nomultibyte
Date: Sun, 25 Sep 2022 11:34:59 +0100	[thread overview]
Message-ID: <9382d4c99158b30b26e6cdf9b64f225d@chazelas.org> (raw)
In-Reply-To: <5DEC33AD-021F-42CD-A08E-F8BDEC23BD0A@kba.biglobe.ne.jp>

On 2022-09-24 12:04, Jun. T wrote:
[...]
> Does this solve the problem?
[...]

Thanks that's better, but now:

$ echo $options[multibyte]
off
$ printf %s {$'\x80'..$'\xff'} | hexdump -C
00000000  5c 4d 2d 5e 40 5c 4d 2d  5e 41 5c 4d 2d 5e 42 5c  
|\M-^@\M-^A\M-^B\|
00000010  4d 2d 5e 43 5c 4d 2d 5e  44 5c 4d 2d 5e 45 5c 4d  
|M-^C\M-^D\M-^E\M|
00000020  2d 5e 46 5c 4d 2d 5e 47  5c 4d 2d 5e 48 5c 4d 2d  
|-^F\M-^G\M-^H\M-|
00000030  5c 74 5c 4d 2d 5c 6e 5c  4d 2d 5e 4b 5c 4d 2d 5e  
|\t\M-\n\M-^K\M-^|
00000040  4c 5c 4d 2d 5e 4d 5c 4d  2d 5e 4e 5c 4d 2d 5e 4f  
|L\M-^M\M-^N\M-^O|
00000050  5c 4d 2d 5e 50 5c 4d 2d  5e 51 5c 4d 2d 5e 52 5c  
|\M-^P\M-^Q\M-^R\|
00000060  4d 2d 5e 53 5c 4d 2d 5e  54 5c 4d 2d 5e 55 5c 4d  
|M-^S\M-^T\M-^U\M|
00000070  2d 5e 56 5c 4d 2d 5e 57  5c 4d 2d 5e 58 5c 4d 2d  
|-^V\M-^W\M-^X\M-|
00000080  5e 59 5c 4d 2d 5e 5a 5c  4d 2d 5e 5b 5c 4d 2d 5e  
|^Y\M-^Z\M-^[\M-^|
00000090  5c 5c 4d 2d 5e 5d 5c 4d  2d 5e 5e 5c 4d 2d 5e 5f  
|\\M-^]\M-^^\M-^_|
000000a0  c2 a0 c2 a1 c2 a2 c2 a3  c2 a4 c2 a5 c2 a6 c2 a7  
|................|
000000b0  c2 a8 c2 a9 c2 aa c2 ab  c2 ac c2 ad c2 ae c2 af  
|................|
000000c0  c2 b0 c2 b1 c2 b2 c2 b3  c2 b4 c2 b5 c2 b6 c2 b7  
|................|
000000d0  c2 b8 c2 b9 c2 ba c2 bb  c2 bc c2 bd c2 be c2 bf  
|................|
000000e0  c3 80 c3 81 c3 82 c3 83  c3 84 c3 85 c3 86 c3 87  
|................|
000000f0  c3 88 c3 89 c3 8a c3 8b  c3 8c c3 8d c3 8e c3 8f  
|................|
00000100  c3 90 c3 91 c3 92 c3 93  c3 94 c3 95 c3 96 c3 97  
|................|
00000110  c3 98 c3 99 c3 9a c3 9b  c3 9c c3 9d c3 9e c3 9f  
|................|
00000120  c3 a0 c3 a1 c3 a2 c3 a3  c3 a4 c3 a5 c3 a6 c3 a7  
|................|
00000130  c3 a8 c3 a9 c3 aa c3 ab  c3 ac c3 ad c3 ae c3 af  
|................|
00000140  c3 b0 c3 b1 c3 b2 c3 b3  c3 b4 c3 b5 c3 b6 c3 b7  
|................|
00000150  c3 b8 c3 b9 c3 ba c3 bb  c3 bc c3 bd c3 be c3 bf  
|................|
00000160


That's bytes 0x80 to 0x9f with their \M-^X representation followed by 
UTF-8
encoded (in my locale using UTF-8 as charmap) characters U+00A0 to 
U+00FF
instead of bytes 0x80 to 0xff which I'd expect with nomultibyte.

In any case, that (documented) transliteration of unprintable characters 
means
I can't use it for what I initially intended to (get a range of 
arbitrary byte
values). It seems braceccl's {$'\0'-$'\xff'} works for that though 
(though the
documentation suggests it may not be future proof):

> unchanged, unless the option BRACE_CCL (an abbreviation for 'brace
> character class') is set.  In that case, it is expanded to a list of 
> the
> individual characters between the braces sorted into the order of the
> characters in the ASCII character set (multibyte characters are not
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> currently handled).  The syntax is similar to a [...]  expression in
   ^^^^^^^^^^^^^^^^^^

-- 
Stephane


  reply	other threads:[~2022-09-25 11:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 10:54 Stephane Chazelas
2022-09-24 11:04 ` Jun. T
2022-09-25 10:34   ` Stephane Chazelas [this message]
2022-09-26  5:49     ` Jun T
2022-09-28  6:03       ` Stephane Chazelas
2022-09-28  7:53         ` Jun T
2022-09-28  9:52           ` Stephane Chazelas

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=9382d4c99158b30b26e6cdf9b64f225d@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --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).