git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t5562: do not reuse output files

From
Max Kirillov <max@max630.net>
Date
Nov 24, 2018, 07:04 UTC
Message-ID
<20181124070428.18571-1-max@max630.net>
In-Reply-To
<CAPUEspi67=Kt=mx21bjG2oCATnU+byO5nkvbMdQkN03yBGZMsA@mail.gmail.com>

Some expected failures of git-http-backend leave running its children (receive-pack or upload-pack) which still hold opened descriptors to act.err and with some probability they live long enough to write their failure messages after next test has already truncated the files. This causes occasional failures of the test script.

Avoid the issue by unlinking the older files before writing to them.
Reported-by: Carlo Arenas <carenas@gmail.com>
Helped-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Max Kirillov <max@max630.net>
---
Thanks for the analysis. I seem to have guessed the reason.
This patch should prevent it.
I think the tests should somehow make sure there are no such late
processes. I can see 2 options:
* somehow find out in the tests all children and wait for them. I have no idea how.
* make http-backend close handle to its child and wait for it to exit before dying.
  This would not prevent childrenc in general, because http-backend may be killed,
  but not in our expected failure cases
Actually, don't the children receive some SIGHUP? Maybe thy should. However, it
would still take some time for them to handle it, so it does not fully solve the issue
 t/t5562-http-backend-content-length.sh | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh
index 90d890d02f..bb53f82c0c 100755
--- a/t/t5562-http-backend-content-length.sh
+++ b/t/t5562-http-backend-content-length.sh
@@ -25,6 +25,8 @@ test_http_env() {
 	handler_type="$1"
 	request_body="$2"
 	shift
+	(rm -f act.out || true) &&
+	(rm -f act.err || true) &&
 	env \
 		CONTENT_TYPE="application/x-git-$handler_type-pack-request" \
 		QUERY_STRING="/repo.git/git-$handler_type-pack" \
@@ -155,6 +157,8 @@ test_expect_success 'CONTENT_LENGTH overflow ssite_t' '
 '
 
 test_expect_success 'empty CONTENT_LENGTH' '
+	(rm -f act.out || true) &&
+	(rm -f act.err || true) &&
 	env \
 		QUERY_STRING="service=git-receive-pack" \
 		PATH_TRANSLATED="$PWD"/.git/info/refs \
-- 
2.19.0.1202.g68e1e8f04e
Previous: Carlo ArenasNext: Junio C Hamano
Message 20 of 35 in “t5562: skip if NO_CURL is enabled”
  1. t5562: skip if NO_CURL is enabledCarlo Marcelo Arenas Belón, Nov 19, 2018
  2. Ævar Arnfjörð BjarmasonNov 19, 2018
  3. Max KirillovNov 19, 2018
  4. Carlo ArenasNov 19, 2018
  5. Max KirillovNov 19, 2018
  6. Jeff KingNov 19, 2018
  7. t5562: fix perl pathMax Kirillov, Nov 22, 2018
  8. Carlo ArenasNov 23, 2018
  9. Jeff KingNov 24, 2018
  10. Jeff KingNov 20, 2018
  11. Carlo ArenasNov 21, 2018
  12. Max KirillovNov 21, 2018
  13. Carlo ArenasNov 21, 2018
  14. Carlo ArenasNov 22, 2018
  15. Max KirillovNov 22, 2018
  16. Carlo ArenasNov 22, 2018
  17. Jeff KingNov 22, 2018
  18. Max KirillovNov 22, 2018
  19. Carlo ArenasNov 23, 2018
  20. t5562: do not reuse output filesMax Kirillov, Nov 24, 2018
  21. Junio C HamanoNov 24, 2018
  22. Junio C HamanoNov 24, 2018
  23. Max KirillovNov 24, 2018
  24. t5562: do not reuse output filesMax Kirillov, Nov 24, 2018
  25. Jeff KingNov 24, 2018
  26. Max KirillovNov 24, 2018
  27. http-backend: enable cleaning up forked upload/receive-pack on exitMax Kirillov, Nov 24, 2018
  28. Junio C HamanoNov 26, 2018
  29. Junio C HamanoNov 26, 2018
  30. Max KirillovNov 28, 2018
  31. t5562: do not reuse output filesMax Kirillov, Nov 24, 2018
  32. Ævar Arnfjörð BjarmasonNov 28, 2018
  33. Jeff KingDec 1, 2018
  34. SZEDER GáborNov 28, 2018
  35. Jeff KingDec 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.