[comp.windows.x] Pyramid xterm

bob@tyranosaur.cis.ohio-state.edu (Bob Sutterfield) (09/05/89)

In an X11R3 xterm client running on a Sun (or anything else I've got
to test with), when I say
	cat < /dev/tty
the cat will wait indefinitely for me to type something.  When I type
a carriage return, that line is echoed.  This continues until I type
my eof character, when I get my shell prompt back.  $status==0.

In an xterm client running on a Pyramid, `cat < /dev/tty' exits
immediately, returning me to my shell.  $status==0.

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'm not complaining about Pyramid's support or anything like that,
because I'm running the MIT code and we haven't paid Pyramid for their
commercial-grade bulletproof X port, so we don't have it.  I'm just
curious whether anyone has already solved this one and is willing to
share their solution for free, or whether it's time to dive into a
Pyramid xterm with dbx (again).

Any clues?

bg@draken.comp.sys.pyramid (Bj|rn Gr|nvall) (09/07/89)

[...]
> 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@nada.kth.se
phone: +46-8-7909101
--

	/Bj|rn.