On Tue, Dec 31, 2013 at 12:02:21PM -0700, Bob Proulx wrote:
> Julian Gilbey wrote:
> > I can't find much rhyme or reason to this one.  ls | head or ls -l |
> > head sometimes dies with a broken pipe, but other times it doesn't.
> 
> Your report sounds like the classic problem of what happens when
> people ignore SIGPIPE in the shell.  Some years back this was a
> widespread problem.  Perhaps you have a SIGPIPE trap handler set in
> your shell?

Hi Bob!

I'm not aware of having a SIGPIPE trap handler set in my shell.

> If this is the issue you see then the solution is to locate where
> SIGPIPE is being ignored and remove it so that it can terminate the
> writing process appropriately.  I can say more and explain the issue
> in more detail if this is the problem.
> 
> What is the output of 'trap' at the command line?

Here's some output - it doesn't seem to be obviously the problem
you've described, but it is certainly shell-related, or perhaps
terminal related:

erdos:~ $ trap
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
erdos:~ $ yes | head -n1
y
yes: standard output: Broken pipe
yes: write error
erdos:~ $ set | grep TRAP
erdos:~ $ set | grep trap
                --buildresult --aptcache --removepackages --extrapackages 
--configfile \
                --compressprog --debootstrapopts --save-after-login 
--save-after-exec \
                --debootstrap'                 -- "$cur" ));
erdos:~ $ sh
$ yes | head -n1
y
yes: standard output: Broken pipe
yes: write error
$ 
erdos:~ $ dash
$ yes | head -n1
y
yes: standard output: Broken pipe
yes: write error
$ 
erdos:~ $ csh
erdos{~}% yes | head -n1
y
yes: standard output: Broken pipe
yes: write error
erdos{~}% exit
exit

But if I log in at a console or via ssh:

erdos:~ $ ssh localhost
Linux erdos 3.11-2-amd64 #1 SMP Debian 3.11.10-1 (2013-12-04) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have mail.
Last login: Tue Dec 31 20:46:36 2013
erdos:~ $ yes | head -n1
y
erdos:~ $ 

I can't see anything obviously different in the environments which
would account for this difference in behaviour, though :-(

I'm running under xfce4 in an xfce4-terminal, if that helps.

Bemused,

   Julian


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to