Package: shellutils Version: 1.12-5 When tee has stdout going to a pipe and the named file going to an ordinary file, if the pipe is closed before tee has written everything, it does not write everything to the named file.
If tee's stdout is a file, but it can't write everything to stdout, it will still write everything to the named file. The pipe case should work like this as well. I've been having some problems with truncated mail. This was the cause. 1 $ ls -l /usr/dict/english 2 -rw-r--r-- 1 root root 409048 Mar 1 12:45 /usr/dict/english 3 $ cat /usr/dict/english | tee output > /dev/full 4 tee: standard output: No space left on device 5 [status 1] 6 $ ls -l output 7 -rw-r--r-- 1 liw liw 409048 Aug 24 07:59 output 8 $ cat /usr/dict/english | tee output | cat > /dev/full 9 cat: write error: No space left on device 10 Broken pipe 11 [status 1] 12 $ ls -l output 13 -rw-r--r-- 1 liw liw 8192 Aug 24 07:59 output 14 $ Line 2 shows the input file (about 400 kB). Lines 3-7 show what happens when tee fails to write to the standard output, when it is going to the special device /dev/full (all writes to /dev/full return ENOSPC). Note that the file `output' is identical to the input file, even though output to stdout failed. Lines 8-13 show what happens when the output goes to a pipe, and the other end of the pipe is closed before tee has written everything. Note that the file `output' is smaller than the input. I can't see anything obviously wrong with the code. -- Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me. Please don't Cc: me when replying to my message on a mailing list.
pgp6gVetoHDCP.pgp
Description: PGP signature