If I do a

svn log | head

after the tenth line of output I get an error message:

svn: Write error: Broken pipe

What's going on here? I haven't seen any other command do this when used with head. Is Subversion unfriendly to the Unix filtering paradigm?


2 Answers 2


When you write to a pipe whose other end has been closed, you normally receive a SIGPIPE signal and die. However, if you choose to ignore that signal, as svn does, then instead the write returns with -1 and errno set to EPIPE whose English translation is "Broken pipe". And svn chooses to display that error message when it fails to write something to its standard output.

head terminates after it has written 10 lines from its input and as a result closes the pipe. svn won't be able to write any more to that pipe. Most applications then die silently as the default behaviour when they're not ignoring SIGPIPE. svn for some reason (maybe because it needs to do extra things before dying) chooses to ignore the SIGPIPE and determine that it can't write anymore to the pipe by checking the error status of the write to the pipe.

You get the same error with:

bash -c 'trap "" PIPE; while echo foo; do :;done' | head


strace -e write seq 10000 | head

(on Linux) to see what the default behaviour is when you're not ignoring SIGPIPE.


This is a longstanding Subversion issue (first raised in 2007, and not fixed until 2011). The reasons for the svn developers not fixing it for so long are not entirely clear, but you can read all the gory details, including that this was fixed in 1.7.0, in the linked bug report. So if this behaviour is really a problem for you, then check your svn client version (svn --version), and consider upgrading...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .