Skip to content

t5411 out file overwrite fix

Jiang Xin git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 4 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2t5411: remove file after use to prevent overwritingt/t5411/test-0000-standard-git-push.sh t/t5411/test-0001-standard-git-push--porcelain.sh t/t5411/test-0002-pre-receive-declined.sh +17 more+84 -02 replies
1/2t5411: use different out file to prevent overwritingt/t5411/test-0000-standard-git-push.sh t/t5411/test-0001-standard-git-push--porcelain.sh t/t5411/test-0002-pre-receive-declined.sh +17 more+98 -987 replies
2/2t5411: refactor check of refs using test_cmp_refst/t5411/common-functions.sh t/t5411/once-0010-report-status-v1.sh t/t5411/test-0000-standard-git-push.sh +28 more+126 -2640 replies
2/2t5411: refactor check of refs using test_cmp_refst/t5411/common-functions.sh t/t5411/once-0010-report-status-v1.sh t/t5411/test-0000-standard-git-push.sh +28 more+126 -2640 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchJohannes SixtSZEDER Gábor
1/2Helped-by Helped-by Helped-by
1/2Helped-by Helped-by Helped-by
2/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] t5411 out file overwrite fix

From: Jiang Xin <[email protected]>

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 <[email protected]>

## 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.

+ Helped-by: Johannes Sixt <[email protected]>

## t/t5411/test-0000-standard-git-push.sh ##
@@ t/t5411/test-0000-standard-git-push.sh: test_expect_success "git-push --atomic ($PROTOCOL)" '

... ...

Signature · 39 lines
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