Re: I/O semantics of pipe and FIFO.

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Wed, 8 Mar 2017 16:19:47 -0800 (PST)
On  8 Mar, Devin Teske wrote:
> Problem we had found was:
> 
> Executing dd with a closed stdout and stderr would cause the summary
> messages printed at the end to go into the destination output file.
> 
> For example,
> 
> dd if=/dev/zero of=/tmp/foo bs=1m count=1
> 
> Works fine, but the following:
> 
> dd if=/dev/zero of=/tmp/foo bs=1m count=1 >&- 2>&-
> 
> Will cause the summary statistics of dd to appear in /tmp/foo instead
> of on the console.
> 
> The issue is that the summary statistics are send to fd1, which if you
> close down stdout and stdin, fd1 is actually the output file since it
> got the lowest file descriptor available when open(2) was called on
> the output file.
> 
> This was never fixed because it was deemed ´silly developer, don˙t
> close stdout and stderr before invoking ddˇ.
> 
> The argument has been made by Jilles T. that it is generally a bad
> idea to close down any of the standard file descriptors because it
> cannot be predicted how a particular UNIX utility will react (e.g., in
> the case of dd, causing a simple printf(3) to go to an unexpected
> location).

Shades of:

- From our Harris VOS system.
   JOBCNTRL ER  2211 : IT'S NOT NICE TO FOOL POP!
   >he 2211
   YOU JUST TRIED TO FAKE-OUT MOTHER NATURE, AND SHE CAUGHT YOU!  SUPER-
   VULCAN NOW HAS YOUR NAME ON HIS ENEMY LIST, AND YOU CAN BE CERTAIN THAT
   FUTURE ATTEMPTS TO RESOURCE LFN 0,3,OR 6 WILL RESULT IN YOUR BEING
   ABORTED, SPINDLED, MANGLED, FOLDED, PUNCHED, DELETED, AND DEALLOCATED.
Received on Wed Mar 08 2017 - 23:20:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:10 UTC