Pyramid xterm (premature file closure?) bug

Bj|rn Gr|nvall bg at draken.nada.kth.se
Thu Sep 7 16:48:40 AEST 1989


Sorry if you already read this in comp.windows.x.

[...]
> This is quite frustrating when running applications like the stock su
> or an FTP client, or any other that takes the easy way out and opens
> /dev/tty for reading.
> 
> X11R3 xterm on most everything but a Pyramid works correctly in this
> respect.  X10R4 xterm had exactly the same behavior: correct
> everywhere but on a Pyramid.  (I had hoped the problem would go away
> in X11, but I guess not...)

I don't think the problem is in xterm but rather in /dev/tty.
Consider the behaviour of the following program when run under an xterm
and `inside' a script command.

draken-15> cat pyr.bug.c
#include <fcntl.h>

main()
{
  char ch;
  int fd = open("/dev/tty", O_RDWR);
  if (fd == -1)
    perror("open failed");
  if (write(fd, "foo\n", 4) != 4)
    perror("write failed\n");
  if (read(fd, &ch, 1) != 1)
    perror("read failed\n");
}
draken-16> cc pyr.bug.c
draken-17> ./a.out
foo
read failed
: Bad file number					<--- Should not happen!
draken-18> script
Script started, file is typescript
draken-1> ./a.out
foo
							<-- Ok!
draken-2> exit
Script done, file is typescript
draken-19>

Does anybody know if this is fixed in 4.4c?

Bj|rn Gr|nvall	(Bjorn Gronvall)
Royal Institute of Technology, NADA
100 44 Stockholm
Sweden
email: bg at nada.kth.se
phone: +46-8-7909101

--

	/Bj|rn.



More information about the Comp.sys.pyramid mailing list