On Fri, 15 Jun 2018 15:15:23 +0200, Davide Brini wrote:
> So it looks like the only "reliable" way to detect NULs in the input is to
> read one character at a time.
Your explanation got me thinking, and I've come up with the following code
that seems to be slightly more efficient than reading on
On 6/15/18 9:36 AM, Siteshwar Vashisht wrote:
> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
>
> Description:
> Bash fails to exit and shows 100% cpu usage if parent sshd process is
> killed while performing command search.
Thanks for the report. This was fixed in the dev
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'
On Fri, 15 Jun 2018 09:07:46 -0400, Greg Wooledge
wrote:
> On Fri, Jun 15, 2018 at 03:03:21PM +0200, Davide Brini wrote:
> > $ printf 'a\x00\x00bc' | { while IFS= read -d '' -n 2 var; do echo
> > "read: $var, length: ${#var}"; done; } read: a, length: 1
> > read: , length: 0
> > read: bc, length:
On Fri, Jun 15, 2018 at 03:03:21PM +0200, Davide Brini wrote:
> $ printf 'a\x00\x00bc' | { while IFS= read -d '' -n 2 var; do echo "read:
> $var, length: ${#var}"; done; }
> read: a, length: 1
> read: , length: 0
> read: bc, length: 2
>
> I would expect there to be another read of length 0 betwee
Best explained with an example:
$ printf 'a\x00\x00bc' | { while IFS= read -d '' -n 1 var; do echo "read: $var,
length: ${#var}"; done; }
read: a, length: 1
read: , length: 0
read: , length: 0
read: b, length: 1
read: c, length: 1
This is as expected, and allows detecting a NUL in the input wh