Ticket #38208

yash hangs when reading dot script without final newline from FIFO

Open Date: 2018-04-16 05:41 Last Update: 2018-05-18 23:52

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
1 - Lowest
Resolution:
Invalid
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
$ 

Attachment File List

No attachments

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
Comment

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
Comment

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
Comment

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
Comment

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
  • Status Update from Open to Closed
  • Resolution Update from None to Invalid
Comment

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.

Edit

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