bug-bash
[Top][All Lists]
Advanced

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

Re: read builtin doesnt save partial reads on timeout


From: Chet Ramey
Subject: Re: read builtin doesnt save partial reads on timeout
Date: Tue, 7 Jun 2016 16:50:59 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 6/6/16 10:01 AM, George Schwab wrote:

> Bash Version: 4.3
> Patch Level: 11
> Release Status: release
> 
> Description:
>         The read builtin does not appear to save partial reads to the
> variable when a timeout has occured.
>         This is contrary to the documentation which states 'read saves any
> partial input read into the specified variable'
>        
> https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html#Bash-Builtins
>         Perhaps this is just an error in the documentation. either way,
> should be fixed, right?
>         A friend has tested this on 4.4.0(1)-rc2 as well.
> 
> Repeat-By:
>         read -N2 -t1 < <(printf x; sleep 2; printf y); echo "$REPLY"

$ ../bash-4.3-patched/bash --version
GNU bash, version 4.3.42(28)-release (x86_64-apple-darwin12.5.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ cat x26
read -N2 -t1 < <(printf x; sleep 2; printf y); echo "$REPLY : $?"
$ ../bash-4.3-patched/bash ./x26
x : 142

>         { read -t1 a; read b; } < <(printf x; sleep 2; printf y); echo
> "<$a><$b>"

I get <x><y> with this example.

-- 
``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]