]> git.ipfire.org Git - thirdparty/git.git/commit
receive-pack: gently write messages to proc-receive
authorJiang Xin <worldhello.net@gmail.com>
Wed, 11 Nov 2020 11:32:01 +0000 (19:32 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Nov 2020 20:46:56 +0000 (12:46 -0800)
commitf65003b4c4abea49a00cc9f3d87b9f37db6b48f1
tree9518439d6d8638d14588af6de29ed8490f4f7c42
parentcf3d868f353c4a5a9ecf4fbc2a44960671ba59cb
receive-pack: gently write messages to proc-receive

Johannes found a flaky hang in `t5411/test-0013-bad-protocol.sh` in the
osx-clang job of the CI/PR builds, and ran into an issue when using
the `--stress` option with the following error messages:

    fatal: unable to write flush packet: Broken pipe
    send-pack: unexpected disconnect while reading sideband packet
    fatal: the remote end hung up unexpectedly

In this test case, the "proc-receive" hook sends an error message and
dies earlier. While "receive-pack" on the other side of the pipe
should forward the error message of the "proc-receive" hook to the
client side, but it fails to do so. This is because "receive-pack"
uses `packet_write_fmt()` and `packet_flush()` to write pkt-line
message to "proc-receive" hook, and these functions die immediately
when pipe is broken. Using "gently" forms for these functions will get
more predicable output.

Add more "--die-*" options to test helper to test different stages of
the protocol between "receive-pack" and "proc-receive" hook.

Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
t/helper/test-proc-receive.c
t/t5411/test-0013-bad-protocol.sh
t/t5411/test-0014-bad-protocol--porcelain.sh