任务单 #38208

yash hangs when reading dot script without final newline from FIFO

开放日期: 2018-04-16 05:41 最后更新: 2018-05-18 23:52

报告人:
属主:
类型:
状态:
关闭
组件:
里程碑:
(无)
优先:
5 - Medium
严重性:
1 - Lowest
处理结果:
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
$ 

任务单历史 (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
评论

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
评论

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
评论

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
评论

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
  • 处理结果 Update from to Invalid
  • 状态 Update from 开启 to 关闭
评论

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

编辑

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