From: Jiang Xin Date: Tue, 19 Jan 2021 10:24:57 GMT Subject: [PATCH v2 0/2] t5411 out file overwrite fix Message-ID: <20210119102459.28986-1-worldhello.net@gmail.com> In-Reply-To: From: Jiang Xin t5411 has some test cases on the behavior of failed 'git push' commands. Even the 'git push' command ended, the output file may still be updated with messages from 'git-receive-pack' command running in background. This breaks test cases which reuse the same 'out' file. ## Changes since v1 + Use different 'out' file instead of removing it which does not work on Windows. ## Range-diff v1..v2 1: 037e52118d ! 1: 3ec70c1c68 t5411: remove file after use to prevent overwriting @@ Metadata Author: Jiang Xin ## Commit message ## - t5411: remove file after use to prevent overwriting + t5411: use different out file to prevent overwriting SZEDER reported that t5411 failed in Travis CI's s390x environment a couple of times, and could be reproduced with '--stress' test on this @@ Commit message - A mixture of the output of 'git show-ref' abd 'git receive-pack' leads to this issue. - To resolve this issue, we can remove the file 'out' after use. The - long-running 'git receive-pack' will not redirect its output to the new - created 'out' file which has a different file descriptor. + The first intuitive reaction to resolve this issue is to remove the + file 'out' after use, so that the newly created file 'out' will have a + different file descriptor and will not be overwritten by the + 'git receive-pack' process. But Johannes pointed out that removing an + open file is not possible on Windows. So we use different temporary + file names to store the output of 'git push' to solve this issue. Reported-by: SZEDER Gábor + Helped-by: Johannes Sixt Signed-off-by: Jiang Xin ## t/t5411/test-0000-standard-git-push.sh ## @@ t/t5411/test-0000-standard-git-push.sh: test_expect_success "git-push --atomic ($PROTOCOL)" ' ... ... -- Jiang Xin (2): t5411: use different out file to prevent overwriting t5411: refactor check of refs using test_cmp_refs t/t5411/common-functions.sh | 15 +++ t/t5411/once-0010-report-status-v1.sh | 5 +- t/t5411/test-0000-standard-git-push.sh | 32 +++---- .../test-0001-standard-git-push--porcelain.sh | 32 +++---- t/t5411/test-0002-pre-receive-declined.sh | 10 +- ...st-0003-pre-receive-declined--porcelain.sh | 10 +- t/t5411/test-0011-no-hook-error.sh | 20 ++-- t/t5411/test-0012-no-hook-error--porcelain.sh | 20 ++-- t/t5411/test-0013-bad-protocol.sh | 95 +++++++------------ t/t5411/test-0014-bad-protocol--porcelain.sh | 95 +++++++------------ t/t5411/test-0020-report-ng.sh | 20 ++-- t/t5411/test-0021-report-ng--porcelain.sh | 20 ++-- t/t5411/test-0022-report-unexpect-ref.sh | 10 +- ...est-0023-report-unexpect-ref--porcelain.sh | 10 +- t/t5411/test-0024-report-unknown-ref.sh | 10 +- ...test-0025-report-unknown-ref--porcelain.sh | 10 +- t/t5411/test-0026-push-options.sh | 22 ++--- t/t5411/test-0027-push-options--porcelain.sh | 22 ++--- t/t5411/test-0030-report-ok.sh | 6 +- t/t5411/test-0031-report-ok--porcelain.sh | 6 +- t/t5411/test-0032-report-with-options.sh | 9 +- ...est-0033-report-with-options--porcelain.sh | 9 +- t/t5411/test-0034-report-ft.sh | 6 +- t/t5411/test-0035-report-ft--porcelain.sh | 6 +- ...t-0036-report-multi-rewrite-for-one-ref.sh | 18 ++-- ...rt-multi-rewrite-for-one-ref--porcelain.sh | 18 ++-- t/t5411/test-0038-report-mixed-refs.sh | 10 +- .../test-0039-report-mixed-refs--porcelain.sh | 10 +- t/t5411/test-0040-process-all-refs.sh | 6 +- .../test-0041-process-all-refs--porcelain.sh | 6 +- ...t-0050-proc-receive-refs-with-modifiers.sh | 18 ++-- 31 files changed, 224 insertions(+), 362 deletions(-) -- 2.28.0.15.gba9e81f0bd