On Tue, Jan 29, 2008 at 01:27:57PM +0100, Jim Meyering wrote: > Rogier Wolff <[EMAIL PROTECTED]> wrote: > ... > > Let me reiterate: It is the first "dd" that is misbehaving, when it > > recieves a write error and SIGPIPE, it simply exits instead of > > reporting the stats. > > Thanks for the report, but that behavior is required by POSIX. > dd must handle SIGINT the way you want, but dd may not handle > SIGPIPE that way: > > ASYNCHRONOUS EVENTS > > For SIGINT, the dd utility shall interrupt its current processing, > write status information to standard error, and exit as though > terminated by SIGINT. It shall take the standard action for all > other signals; see the ASYNCHRONOUS EVENTS section in Section 1.4 > (on page 2280).
Please interpret it as dd is supposed to work: Please block the "SIGPIPE" signal, then write will return: EPIPE fd is connected to a pipe or socket whose reading end is closed. When this happens the writing process will also receive a SIGPIPE signal. (Thus, the write return value is seen only if the program catches, blocks or ignores this signal.) then the write will return EPIPE, which is a normal error code, indicating that writing has stopped, and that stats should be printed. What is dd's "purpose in life"? Device-to-device copy, as it's name suggests? Turns out modern use is often no longer device-to-device. It copies files, and counts and reports the number of blocks copied. This feature is used by some. If you go and change it, things will stop working. If you start "waving standards around", I'll bounce it back for you. SIGPIPE is NOT an asynchronous event. As documented in the quoted documentation for write. It happens synchronously with the write, normally before the return of "EPIPE". Roger. -- ** [EMAIL PROTECTED] ** http://www.BitWizard.nl/ ** +31-15-2600998 ** ** Delftechpark 26 2628 XH Delft, The Netherlands. KVK: 27239233 ** *-- BitWizard writes Linux device drivers for any device you may have! --* Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. Does it sit on the couch all day? Is it unemployed? Please be specific! Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]