bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read fails on null-byte: v4.1.7 FreeBSD 8.0 (amd64)


From: Chet Ramey
Subject: Re: read fails on null-byte: v4.1.7 FreeBSD 8.0 (amd64)
Date: Wed, 23 Nov 2011 16:47:22 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 11/23/11 9:03 AM, Matthew Story wrote:
> Bash Version: GNU bash, version 4.1.7(1)-release (amd64-portbld-freebsd8.0)
>           OS: FreeBSD 8.0
>     Hardware: amd64
>  Environment: jail
>  Description: read terminates reading all records at first null-byte ( chr(0) 
> ) in a stream, null-bytes are valid ascii characters and should not cause 
> read to stop reading
>               a line this behavior is not reproducible using bourne shell.

Bash doesn't stop reading at the NUL; it reads it and the rest of the line
up to a newline.  Since bash treats the line read as a C string, the NUL
terminates the value assigned to `foo'.  Bash doesn't drop NULs like the
FreeBSD (not the Bourne) shell.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]