Strange echo behaviour

Baruch Siach baruch at tkos.co.il
Wed Jan 26 18:21:28 UTC 2011


Hi Jim,

On Wed, Jan 26, 2011 at 08:54:14AM -0800, Cathey, Jim wrote:
> The error, such as it is, is in the implementation of the gpio/export
> proc handler.  The Unix file paradigm is that there is no difference
> in function between writing bulk data as individual bytes or not,
> except for performance and interleaving.  

Then, I'd expect echo to retry the whole IO operation. Instead, echo just 
exits after writing (successfully) the first byte.

> For those rare cases where
> the blocking matters, tools like dd exist.
> 
> Perhaps your command should properly be:
> 
> 	echo 56 | dd obs=3 >/sys/class/gpio/export
> 
> given that you're talking to an inflexible 'device'?

This makes the script much less readable. Isn't it reasonable to expect echo 
not to retry a failed IO operation?

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the busybox mailing list