Hi,

I've found the following issue. When I pipe the output of
"svn diff --diff-cmd diff" and a broken pipe occurs on the
diff command, I get a "Broken pipe" error:

diff: standard output: Broken pipe
svn: E200012: 'diff' returned 2

Tested with svn, version 1.14.1 (r1886195) under Debian 11 (bullseye).

The cause is that svn runs the diff command with SIGPIPE ignored,
so that diff gets an EPIPE write error instead of being killed by
the signal. I think that a fix should be to reset SIGPIPE to the
default action just before executing the external diff command.

To reproduce the bug:

----------------------------------------
#!/bin/sh

set -e

export LC_ALL=C

mkdir my-test-svn
cd my-test-svn

svnadmin create svn
svn co file://`pwd`/svn wc
cd wc

seq 10000 > file
svn add file
svn diff | head
svn diff --diff-cmd diff | head

cd ../..
rm -rf my-test-svn
----------------------------------------

This gives:

Checked out revision 0.
A         file
Index: file
===================================================================
--- file        (nonexistent)
+++ file        (working copy)
@@ -0,0 +1,10000 @@
+1
+2
+3
+4
+5
Index: file
===================================================================
--- file        (nonexistent)
+++ file        (working copy)
@@ -0,0 +1,10000 @@
+1
+2
+3
+4
+5
diff: standard output: Broken pipe
svn: E200012: 'diff' returned 2

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to