[comp.soft-sys.andrew] Typescript under SunOS 4.1?

janssen@parc.xerox.com (Bill Janssen) (08/24/90)

Anyone tried typescript on a Sun SparcStation running SunOS 4.1? 
Doesn't seem to work for me.  The interface window comes up, menus and
keystrokes work, but it doesn't seem to be communicating with the
sub-process shell.  Sometimes I don't get a prompt, and all input to the
sub-process seems to be ignored.

May just need to be re-linked.

Bill

sinkwitz@gorgo.ifi.unizh.ch (Rainer Sinkwitz) (08/27/90)

In article <Yap8zEIB0KGW01iotd@holmes.parc.xerox.com> 
  janssen@parc.xerox.com (Bill Janssen) writes:

>Anyone tried typescript on a Sun SparcStation running SunOS 4.1? 
>Doesn't seem to work for me.  The interface window comes up, menus and
>keystrokes work, but it doesn't seem to be communicating with the
>sub-process shell.  Sometimes I don't get a prompt, and all input to the
>sub-process seems to be ignored.

With me typescript shows the same behaviour. My workstation is running 
under SunOS 4.1 whereas the binaries have been compiled under SunOS 4.0.3.
When I run the same binaries on another workstation which still runs 4.0.3
everything is ok. Funny, isn't it ?

Since all the binaries of X11 and Andrew have been compiled under SunOS 4.0.3
the only difference could probably be /usr/lib/libc which has changed 
from V1.3 to V1.5 . One could link V1.3 statically into runapp then.


Thanks,...
Dept. of Computer Science  |     {backbone}!mcsun!unizh!sinkwitz
University of Zuerich      |         K114920@CZHRZU1A.bitnet
-- 
Thanks,...

Rainer Sinkwitz            | E-mail: sinkwitz@ifi.unizh.ch
Dept. of Computer Science  |     {backbone}!mcsun!unizh!sinkwitz

guy@auspex.auspex.com (Guy Harris) (08/29/90)

>With me typescript shows the same behaviour. My workstation is running 
>under SunOS 4.1 whereas the binaries have been compiled under SunOS 4.0.3.
>When I run the same binaries on another workstation which still runs 4.0.3
>everything is ok. Funny, isn't it ?

Not entirely unexpected - SunOS 4.1's job control and tty mechanisms
have been POSIXized, and stuff that may work under earlier releases to
set up ttys may not work quite the same in 4.1.

>Since all the binaries of X11 and Andrew have been compiled under SunOS 4.0.3
>the only difference could probably be /usr/lib/libc which has changed 
>from V1.3 to V1.5.

No, actually, there's another "library", if you will, that changed,
namely "/vmunix", and...

> One could link V1.3 statically into runapp then.

...you can't statically link "/vmunix" into "runapp".  (I.e., the
semantics of some system calls may have changed.)

Not having 4.1 nor its documentation handy at this moment, I can't
investigate further, but check whether the release notes or change notes
or something such as that discusses this.

janssen@parc.xerox.com (Bill Janssen) (08/29/90)

Sounds to me like the right thing to try is to rebuild under 4.1.  I'll
try that and report back.

Bill

guy@auspex.auspex.com (Guy Harris) (08/31/90)

>Sounds to me like the right thing to try is to rebuild under 4.1.  I'll
>try that and report back.

Well, I finally dragged our 4.1 documentation out of its box.  Starting
on page 52 of the SunOS 4.1 Release Manual, there's a discussion of the
changes to the controlling terminal stuff in 4.1.

It notes that the following BSD-flavored code should cause "/dev/ttya"
to become the process's controlling terminal:

	if ((fd = open("/dev/tty", O_WRONLY)) != -1) {
		(void) ioctl(fd, TIOCNOTTY, 0);
		(void) close(fd);
	}
	(void) setpgrp(0, 0);
	fd = open("/dev/ttya", O_RDWR);

and that the following code might *not* do so:

	if ((fd = open("/dev/tty", O_WRONLY)) != -1) {
		(void) ioctl(fd, TIOCNOTTY, 0);
		(void) close(fd);
	}
	fd = open("/dev/ttya", O_RDWR);

because, while in 4.xBSD, the TIOCNOTTY "ioctl" will zero out the
process's process group, it will not do so in SunOS 4.1.

Now, the code in ".../atk/typescript/tscript.c" that releases the
controlling tty is, for non-HP-UX systems:

    {
	int fd;

	(void)signal(SIGTTOU,SIG_IGN);    /* For handling signals when changing the window size */

	fd = open ("/dev/tty", O_RDWR);
	if (fd >= 0) {
	    ioctl (fd, TIOCNOTTY, 0);
	    close (fd);
	}
#if SY_AIX221
 	else {
 	    ioctl(0, TIOCNOTTY,	0); /* might help when /dev/tty is hosed */
 	    setpgrp();
 	}
#else
        else
            setpgrp(0, 0);
#endif
      }

The astute reader will note that this is similar to the second section
of code - the one that the documentation says won't work.

Given that in 4.xBSD TIOCNOTTY will set the process group to 0, it
appears that it would be harmless to change the code to:

    {
	int fd;

	(void)signal(SIGTTOU,SIG_IGN);    /* For handling signals when changing the window size */

	fd = open ("/dev/tty", O_RDWR);
	if (fd >= 0) {
	    ioctl (fd, TIOCNOTTY, 0);
	    close (fd);
	}
#if SY_AIX221
 	else {
 	    ioctl(0, TIOCNOTTY,	0); /* might help when /dev/tty is hosed */
 	    setpgrp();
 	}
#else
        setpgrp(0, 0);
#endif
      }

so that the "setpgrp(0, 0)" is *always* done.  This should probably be
tried both on a SunOS 4.1 system, and on some non-HP-UX, non-AIX
systems, to see if it works on both systems.  If so, the change should
be put in (no #ifdefs for SunOS 4.1, please, if it works both on SunOS
4.1 and other systems; the code has enough #ifdefs already). 

guy@auspex.auspex.com (Guy Harris) (08/31/90)

>This should probably be tried both on a SunOS 4.1 system, and on some
>non-HP-UX, non-AIX systems, to see if it works on both systems.

It seems to continue to work under SunOS 4.0.3 after changing it to
always do the "setpgrp(0, 0)"; we don't have 4.1 up yet, so I can't try
it there, nor can I try it any other OSes.

janssen@parc.xerox.com (Bill Janssen) (09/01/90)

I tried applying Guy's patch, compiling on a 4.0.3 system, and running
typescript on a 4.1 system, and I get the same problem.  Typescript
can't communicate with the sub-process.

Bill