Tíquete #45760

Spurious suspension in job-control tests

: 2022-10-02 22:29 Última Atualização: 2022-10-06 01:09

Relator:
Dono:
Tipo:
Estado:
Fechado
Componente:
Marcos:
(Nenhum)
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
Nenhum
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

Some tests spuriously suspend where it should finish without interruption.

To reproduce, run ../yash run-test.sh ../yash sighup3-p.tst in the tests directory, for example.

The cause of the suspension comes from the test that starts a job-controlling shell that is killed by a subshell: The first test case starts a job-controlling shell that creates a subshell that is assigned a new process group and sends a signal to kill the parent shell. The subshell exits successfully, but the job-controlling shell is gone, so there is no process that comes back to the foreground. The test goes on while the test runner is left in the background. When the next test case starts another job-controlling shell, it checks if it is in the foreground, which is not the case, and suspends itself until it is brought to the foreground. (This is done in the main function by calling the ensure_foreground function.)

The current Makefile uses ptwrap as in ./ptwrap ./resetsig ../yash ./run-test.sh ../yash sighup3-p.tst which works around the issue. It works because with ptwrap the runner becomes a session leader, which bypasses the SIGTTOU signal sent by the tcsetpgrp function. (POSIX forbids the tcsetpgrp function sending SIGTTOU to an orphaned process group.) However, posix-shell-tests does not use ptwrap and thus will suffer this issue.

Ticket History (3/3 Histories)

2022-10-02 22:29 Updated by: magicant
  • New Ticket "Spurious suspension in job-control tests" created
2022-10-02 22:37 Updated by: magicant
Comentário

This patch will also reveal the issue.

  1. diff --git a/tests/Makefile.in b/tests/Makefile.in
  2. index f6074603..32fdc67a 100644
  3. --- a/tests/Makefile.in
  4. +++ b/tests/Makefile.in
  5. @@ -65,7 +65,7 @@ $(TEST_RESULTS): $(TESTERS) $(YASH)
  6. .tst.trs:
  7. @set $(RUN_TEST) $(TESTEE) $<; \
  8. if grep -q %REQUIRETTY% $<; then \
  9. - if ./ptwrap ./checkfg 2>/dev/null; then \
  10. + if false && ./ptwrap ./checkfg 2>/dev/null; then \
  11. set ./ptwrap "$$@"; \
  12. else \
  13. set $(SHELL) ./enqueue.sh "$$@"; \
2022-10-06 01:09 Updated by: magicant
  • Estado Update from Aberto to Fechado
  • Resolução Update from Nenhum to Fixed
Comentário

Fixed in r4212 and r4213

Attachment File List

No attachments

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login