On Tue, Aug 24, 2021 at 11:14 AM Vincent Lefevre <vincent-...@vinc17.net>
wrote:
>
> 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.

Confirmed.

I don't see mention of it in the issue tracker. Please could you file
it there?

I started looking into it but ran out of time for now. Anyway, SIGPIPE
is ignored throughout the client, for good reasons, since r848296:

(relevant bits of log message):

   - Ignore SIGPIPE, to prevent wedging the repos on network errors,
    or when piping the output to a command that quits before all data
    is read, e.g. head, more or less.

SIGPIPE is disabled in the client (and 2 other programs) by:

+#ifdef SIGPIPE
+  /* Disable SIGPIPE generation for the platforms that have it. */
+  apr_signal(SIGPIPE, SIG_IGN);
+#endif

It would be easy to temporarily re-enable it before executing diff-cmd
but first it's important to make sure that won't break another use
case which the current disabling is handling. (An example of one
question that comes to mind: is it possible to use --diff-cmd with
'svn log -r#### --diff' and if so are there any ramifications to
re-enabling SIGPIPE in that scenario? I haven't checked yet.)

Thanks,
Nathan

Reply via email to