coreutils
[Top][All Lists]
Advanced

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

Re: reading all data from FIFO with 'dd' without blocking


From: Assaf Gordon
Subject: Re: reading all data from FIFO with 'dd' without blocking
Date: Wed, 19 Nov 2014 16:00:03 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

Hello,

On 11/19/2014 02:24 PM, Pádraig Brady wrote:
On 19/11/14 00:40, Assaf Gordon wrote:
<...>

With the above script, 'dd' prints the following:
     dd: error reading ‘standard input’: Resource temporarily unavailable

That error is fine in itself and is just dd indicating that there is no data 
available.
I.E. the shell may have read all the data from the fifo and is splitting it up 
with
the read builtin. So it would probably be better to avoid the read built in and 
use
a loop like:

<...>

However dd's setting of O_NONBLOCK on the _shared_ descriptor is problematic
as it persists across the invocation of dd:

http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/dont-set-shared-file-descriptors-to-non-blocking-mode.html

That's a very non obvious gotcha.
I wonder should we have an [io]flag=block to allow resetting this in dd?


Thank you, that's a terrific FGA post.

I guess for simplicity I'll stay with the 1s delay.

- Assaf.







reply via email to

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