Tíquete #38774

Subshell exit status broken in EXIT traps

: 2018-11-28 01:38 Última Atualização: 2018-12-09 00:29

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

Subshells always return status 0 in EXIT traps.

$ yash -c 'trap "(false) && echo BUG" EXIT'
BUG
$ yash -c 'trap "(false); echo \$?" EXIT'
0

Workaround: if an explicit 'exit' is given, it works as expected.

$ yash -c 'trap "(false; exit \$?); echo \$?" EXIT'
1

Ticket History (3/4 Histories)

2018-11-28 01:38 Updated by: mcdutchie
  • New Ticket "Subshell exit status broken in EXIT traps" created
2018-12-07 23:24 Updated by: magicant
  • Componente Update from (Nenhum) to shell-main
  • Dono Update from (Nenhum) to magicant
2018-12-08 06:05 Updated by: mcdutchie
Comentário

Background info: dash has a similar bug, and the relevant thread there is probably worth following.

2018-12-09 00:29 Updated by: magicant
  • Resolução Update from Nenhum to Fixed
  • Estado Update from Aberto to Fechado
Comentário

Thanks for the info.

Added some tests in r3934 and fixed in r3935 .

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