Skip to content
  • Jeff King's avatar
    t5400: avoid concurrent writes into a trace file · 71406ed4
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    One test in t5400 examines the packet exchange between git-push and
    git-receive-pack. The latter inherits the GIT_TRACE_PACKET environment
    variable, so that both processes dump trace data into the same file
    concurrently. This should not be a problem because the trace file is
    opened with O_APPEND.
    
    On Windows, however, O_APPEND is not atomic as it should be: it is
    emulated as lseek(SEEK_END) followed by write(). For this reason, the
    test is unreliable: it can happen that one process overwrites a line
    that was just written by the other process. As a consequence, the test
    sometimes does not find one or another line that is expected (and it is
    also successful occasionally).
    
    The test case is actually only interested in the output of git-push.
    To ensure that only git-push writes to the trace file, override the
    receive-pack command such that it does not even open the trace file.
    
    Reported-by: default avatarJohannes Sixt <j6t@kdbg.org>
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    71406ed4