Tíquete #38208

yash hangs when reading dot script without final newline from FIFO

: 2018-04-16 05:41 Última Atualização: 2018-05-18 23:52

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

Details

When reading a dot script from a FIFO and that dot script does not end in a newline, yash ignores EOF and hangs waiting for the final newline to arrive. Other shells do not hang on EOF, even if there is no final newline.

$ mkfifo fifo
$ printf 'echo hi' >fifo&
[1] + Running              printf 'echo hi' 1>fifo
$ yash -c '. ./fifo'
( ... hangs ... )
^Z[1] - Done                 printf 'echo hi' 1>fifo
[2] + Stopped(SIGTSTP)     yash -c '. ./fifo'
$ printf '\n' >fifo &
[3]   Running              printf '\n' 1>fifo
$ fg
[2] yash -c '. ./fifo'
hi
[3] - Done                 printf '\n' 1>fifo
$ 

Ticket History (3/6 Histories)

2018-04-16 05:41 Updated by: mcdutchie
  • New Ticket "yash hangs when reading dot script without final newline from FIFO" created
2018-04-17 00:28 Updated by: magicant
  • Details Updated
Comentário

Thanks for reporting, but it does not reproduce on my machine. I tested yash 2.47 on Fedora 27.

$ printf 'echo hi' > fifo &
[1] + Running              printf 'echo hi' 1>fifo
$ ./yash -c '. ./fifo'
hi
[1] + Done                 printf 'echo hi' 1>fifo
$ 
2018-04-17 02:48 Updated by: mcdutchie
Comentário

Hmm. I'm testing yash 2.47 on Mac OS X 10.11.6 and for me it reproduces consistently. I will test other operating systems and report back.

2018-04-17 10:04 Updated by: magicant
Comentário

Thanks for the info. I was able to reproduce on my Mac. It seems the "pselect" function hangs on Mac for no obvious reasons...

2018-04-17 10:41 Updated by: mcdutchie
Comentário

FYI, I also cannot reproduce the issue on FreeBSD (yash 2.46), OpenBSD (yash 2.44), or Solaris (yash 2.45). So it does seem to be a Mac-specific bug.

2018-05-18 23:52 Updated by: magicant
  • Resolução Update from Nenhum to Invalid
  • Estado Update from Aberto to Fechado
Comentário

I did some googling, but I have no clue what is happening in the pselect function on Mac. Since FIFOs are expected to be content-neutral, it is quite mysterious that the behavior of pselect depends on existence of a newline in the content transmitted.

I'm closing this bug because I suppose the weird behavior of pselect on Mac is responsible for the hang.

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