On Wed, Sep 25, 2024 at 07:20:31PM +0200, tlaro...@kergis.com wrote: > On Thu, Sep 26, 2024 at 12:02:08AM +0700, Robert Elz wrote: > > > > That is, currently the read builtin simply ignores \0 bytes in the input, > > except if \0 is the delimiter character. We could change that, and make > > \0 an error - POSIX specifies that the input shall not contain \0 chars > > unless -d has been used to make \0 the delimiter character.
Just to be sure about the nul byte: a nul byte generates an error (non interactive: terminates the process; interactive: stops processing, displays an error and waits for more). But a nul byte given as an escaped sequence does not generate an error and is discarded (present implementation OK, since choice up to the implementation) conforming to (issue 8, taken from 2.2.4 Dollar-Single-Quotes, and applying consistency): ---8<--- If a \xXX or \ddd escape sequence yields a byte whose value is 0, it is unspecified whether that null byte is included in the result or if that byte and any following regular characters and escape sequences up to the terminating unescaped single-quote are evaluated and discarded. --->8--- Is that it? -- Thierry Laronde <tlaronde +AT+ kergis +dot+ com> http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C