[comp.sys.hp] Xterm HP-UX 7.03 and me

longstre@cae.wisc.edu (Jon Longstreth) (06/13/91)

An interesting thing happened to me today.
I was on an HP9000 345 unix workstation using HP-UX 7.03 and the version of X11
that came with it.

Ok, onto what happened, I was in an xterm and managed to get up a neat
menu by holding down the CTRL key and pressing the mouse button in the xterm
window.

The menu had one option which was Interupt.  Just out of curiosity I selected
it. 
WampF!! My X-windows dissapeared and the machine went down to init level 0.
Ouch, Somehow we had managed to delete this run level from our inittab...
So I had to go find another machine, login using telnet, su to root, and
bring the machine back to our normal init level.
Needless to say init level zero is now in our /etc/inittab.
Just thought it was an interesting occurance that you all might be interested 
in.
(and yes this is a very repeatable thing (error/bug?))

Jon Longstreth
Signature temporarily under repair.
email address: longstre@cae.wisc.edu

jrm@hpuerca.HP.COM (John Morris) (06/19/91)

This problem has been reported (SR#5000-557215).  That SR says the
problem is fixed at 8.0 with the R4 xterm.

John Morris

porsche@hpcvlx.cv.hp.com. (John Milton) (06/21/91)

This is the result of a change to the 7.0 version of getpgrp2 to make it POSIX
compliant.  (Evidentally, MIT ran into this problem because it has been fixed
in the R4 version of xterm.)  In the version of xterm supplied with 7.0x, 
selecting the 'Send INT signal' item from the menu causes the following line
to be executed:

    killpg(getpgrp(screen->pid), SIGINT);
    
Which, after substituting for macro definitions, becomes:

    kill(-(getpgrp2(screen->pid)), SIGINT);

In HP-UX 7.0 (and presumably any POSIX compliant OS) getpgrp2 fails if the
current process (xterm) and the specified process (the shell) are not in the
same session (which they aren't).  Thus, when getpgrp2 fails, SIGINT is sent
to init (-(-1)=1), forcing init to run level 0.  The Release 4 version of
xterm is supplied with HP-UX 8.0 and the code has been changed, sending the
signal to the process id of the shell process instead of the shell's process
group (it doesn't call getpgrp2).

Until you upgrade to HP-UX 8.0 don't select the 'Send INT signal' item in the
'Main Options' menu.  (Actually, you probably shouldn't select any of the send
signal options because, for the reasons outlined above, the signal is sent to
init rather than the shell's process group.)

John "porsche is a two syllable word" Milton
porsche@hp-pcd

porsche@hpcvlx.cv.hp.com. (John Milton) (06/21/91)

One additional note, xterm is able to send signals to init because it runs
as set uid root.  Changing permissions on xterm is not advised because xterm
needs root permissions in order to write to /etc/utmp.

John Milton
porsche@hp-pcd