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

Is t7006-pager.sh racy?

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 24, 2021, 00:04 UTC
Message-ID
<xmqq1r4b8ezp.fsf@gitster.g>

It seems under --stress it is fairly easy to break the said test, especially the one near the end

    test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
            test_when_finished "rm pager-used trace.normal" &&
            test_config core.pager ">pager-used; test-tool sigchain" &&
            GIT_TRACE2="$(pwd)/trace.normal" &&
            export GIT_TRACE2 &&
            test_when_finished "unset GIT_TRACE2" &&
            if test_have_prereq !MINGW
            then
                    OUT=$( ((test_terminal git log; echo $? 1>&3) | :) 3>&1 ) &&
                    test_match_signal 13 "$OUT"
            else
                    test_terminal git log
            fi &&
            grep child_exit trace.normal >child-exits &&
            test_line_count = 1 child-exits &&
            grep " code:143 " child-exits &&
            test_path_is_file pager-used
    '

When it fails the code in child-exits is actually -1 not 143, a propagated pipe.

What makes us expect that the "git log" invocation should trigger a SIGPIPE in the first place? test-sigchain emitting a few lines and exiting without ever reading from its standard input? Will it reliably die soon enough before, or linger around until, we attempt to write to the pager? If it does not die quickly enough, can we attempt to write, successfully fill the buffer between us and the pager, and wait to notice that test-sigchain exiting with non-zero, or something?

Next: SZEDER Gábor
Message 1 of 17 in “Is t7006-pager.sh racy?”
  1. Junio C HamanoOct 24, 2021
  2. SZEDER GáborOct 24, 2021
  3. Jeff KingOct 25, 2021
  4. SZEDER GáborOct 28, 2021
  5. Jeff KingOct 28, 2021
  6. Jeff KingNov 21, 2021
  7. Jeff KingNov 21, 2021
  8. t7006: clean up SIGPIPE handling in trace2 testsJeff King, Nov 21, 2021
  9. Jeff KingNov 21, 2021
  10. Junio C HamanoNov 22, 2021
  11. Jeff KingNov 22, 2021
  12. Jeff KingNov 22, 2021
  13. Junio C HamanoNov 22, 2021
  14. Junio C HamanoNov 22, 2021
  15. Jeff KingNov 22, 2021
  16. run-command: unify signal and regular logic for wait_or_whine()Jeff King, Nov 22, 2021
  17. Ævar Arnfjörð BjarmasonDec 1, 2021

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.