diff options
author | Jeff King <peff@peff.net> | 2013-07-12 06:35:23 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-12 09:24:29 -0700 |
commit | 4783e7ea83e39f19e0ef03372fd721f159d1f1de (patch) | |
tree | 2f5dce6bed6f8cc1018dc8e7c710b49cac83017c /builtin/mktag.c | |
parent | t0008: use named pipe (FIFO) to test check-ignore streaming (diff) | |
download | tgif-4783e7ea83e39f19e0ef03372fd721f159d1f1de.tar.xz |
t0008: avoid SIGPIPE race condition on fifo
To test check-ignore's --stdin feature, we use two fifos to
send and receive data. We carefully keep a descriptor to its
input open so that it does not receive EOF between input
lines. However, we do not do the same for its output. That
means there is a potential race condition in which
check-ignore has opened the output pipe once (when we read
the first line), and then writes the second line before we
have re-opened the pipe.
In that case, check-ignore gets a SIGPIPE and dies. The
outer shell then tries to open the output fifo but blocks
indefinitely, because there is no writer. We can fix it by
keeping a descriptor open through the whole procedure.
This should also help if check-ignore dies for any other
reason (we would already have opened the fifo and would
therefore not block, but just get EOF on read).
However, we are technically still susceptible to
check-ignore dying early, before we have opened the fifo.
This is an unlikely race and shouldn't generally happen in
practice, though, so we can hopefully ignore it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/mktag.c')
0 files changed, 0 insertions, 0 deletions