whm@arizona.UUCP (06/06/83)
I ran into a strange problem with a system that I did this last semester. The system provided rudimentary history and programabilty for an "arbitrary" program that had a command language of some type. The basic idea was to have a master program that would read the user's input and pass it to a slave program and then pass the output of the slave program back to the user. To do this, I needed to "see" all input and output for the program being run by the master program. I did this by opening a pair of pipes to the slave program from the master program, one for standard input and one for standard output. For most programs, this crude scheme worked out without any problems. However, for some programs that produced a line of output that was not newline terminated, the data on the "last" line would never appear. Two programs in point are ucbmail and ex. I tried opening just a read pipe to the various programs in question, and there were no problems; all the data written by the program could be read through the pipe. The problem only occurred when a write pipe was also open to the program. All streams were unbuffered. BTW-This was on 4.1bsd. I've since decided to use a more sophisticated IPC mechanism, such as mpx files or the new Berkeley IPC stuff, but I'm still curious about the bug. Anybody have any ideas? Bill Mitchell
chris.umcp-cs%udel-relay@sri-unix.UUCP (06/07/83)
From: Chris Torek <chris.umcp-cs@udel-relay> From: ihnp4!arizona!whm@ucb-vax ... However, for some programs that produced a line of output that was not newline terminated, the data on the "last" line would never appear. Two programs in point are ucbmail and ex. ... The problem only occurred when a write pipe was also open to the program. All streams were unbuffered. BTW-This was on 4.1bsd. I don't know about ucbmail, but ex seems to have great troubles when it's not connected to a terminal. It wants to stty, and when it fails, thinks that is some other error. If I run "ex | cat -u" I get "missing lhs" (!). It may just be someone trying to get around stdio (ex moves mountains to do this). I've since decided to use a more sophisticated IPC mechanism, such as mpx files or the new Berkeley IPC stuff, but I'm still curious about the bug. Anybody have any ideas? Probably someone didn't consider that you might want to use pipes. - Chris seismo!umcp-cs!chris chris.umcp-cs@UDel-Relay