Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: =~ doesn't work with NUL characters

2017-06-14 16:49:38 -0400, Phil Pennock:
> Trying to support this would result in variations in behaviour across
> systems in a way which I think might be undesirable.  The whole point of
> adding the non-PCRE implementation was to match Bash behaviour by
> default, and Bash does the same thing.

Note that bash does not support the NUL character anywhere (except
(mostly by accident) for read -d '' and now readarray -d '', and
it strips it in some contexts to limit the damage).

In bash, [[ $'a\0b' = a ]] would also be true, just like
echo $'a\0b' would output a\n because $'x\0anything' is always x

zsh AFAIK is the only shell that attempts to handle the NUL
character (making it the only shell that can reliably handle
arbitrary data internally).

There are still a few issues here and there like this one (or
the strcoll() one discussed not so long ago), when interacting
with the rest of the system that can't cope with it. The most
obvious one and that can't be fixed is the parameters to the
execve() system call (external command arguments and environment


Messages sorted by: Reverse Date, Date, Thread, Author