[comp.sys.sun] xterm problems under Sun OS 4.0

johnr@uunet.uu.net (John Reed) (12/22/88)

I'm having a couple of problems with xterm under Sun4OS.  We have a
Sun4/280 that is being used as our client host.  We are using Version 11,
Release 2 of X We currently have only 1 useable X tube on our E-net.


1.  xterm receives a hangup signal when there is no local entry in
    the password file

    Our Sun 4 uses a yellow pages password file, and the local password
    file in "/etc" does not contain any "user" entries.

    From any terminal connected to the system, type in "xterm &".
    Assuming that the DISPLAY environment variable is set up correctly.

    The program receives a hangup signal.  Nothing happens on the X tube

    This can be remedied by making a local entry for your user in the
    "/etc" password file.

    The following adb session shows a stack trace after the signal was
    received:

% adb /home/X/bin/xterm
:r
SIGHUP 1: hangup
stopped at      _close+8:       bgeu    _close + 0x18
$c
_close() + 8
_clntudp_create(0x5f050,0x5efe4,0x5dc00,0x0,0x65636800,0x5f068) + 65c
_yp_unbind(0x5ef60,0xf7ffe954,0xf7ffe964,0x0,0x65636800,0x5efd8) + 60
_yp_get_default_domain(0x5ef60,0xf7ffea6c,0x2,0x5ef60,0x1,0x5efd8) + 128
__yp_dobind(0x5ef60,0xf7ffea6c,0x5dc00,0xa,0x81010100,0xff00) + e4
_yp_match(0x5ef60,0x581ef,0xf7ffeaec,0x3,0xf7ffeae8,0xf7ffeae4) + 1bc
_getpwent(0x6d,0x5e490,0xa,0x0,0xf7ffeaec,0x68310) + 9b4
_getpwent(0xf7ffecc7,0xf7ffecc0,0x6d,0x0,0x68310,0x6834c) + 540
_getpwuid(0x6d,0x2,0x0,0x5de4d,0x68310,0xf7ffecc7) + 7c
_spawn(0x1,0x3,0x5,0xd8,0xd8,0xd) + 8c0
_main(0xffffffff,0x5fbf0,0xffffffff,0xffffffff,0x59bec,0xffffffff) + 868
$q
%

     Again, this situation can be remedied by adding a local entry into
     the password file.

     We also have a Sun 3 (running Sun 3.4OS) and its password file is set up
     identically.  We can use this host as the X client machine and run
     xterm with no problems whatsoever.

     Have I found a bug in Sun's 4.0 OS ??  The problem seems to be with
     getpwuid().


2.   xterm will terminate with an error when invoked from uwm's "New window"
     menu.

     This is a strange one!  The scenario is as follows:

     I start up the uwm window manager on my X tube from our Sun 4 which
     is running 4.0 OS.  Now I choose the "New Window" menu item from
     uwm's main menu.

     The xterm window never shows up on the tube.

     I have hacked on this for awhile, and discovered the problem area and
     have also hacked in a fix.

     The following code in function "spawn()" of main.c is the culprit:

	signal(SIGALRM, hungtty);
	alarm(1);
	if (! setjmp(env)) {
		tty = open ("/dev/tty", O_RDWR, 0);
		alarm(0);
	} else {
		tty = -1;
		errno = ENXIO;
	}
	signal(SIGALRM, SIG_DFL);

     It turns out that the open call returns a -1, and sets errno to EIO.

     I remedied the situation by adding this code just after the open call:

		if (tty == -1 && errno == EIO)
			errno = ENXIO;

     Don't tell me, I know this is a terrible hack fix, but at least it
     works.  There may be some legitimate errors that are being missed
     because of this hack, but I have yet to experience any trouble after
     adding this fix.

     Any further ideas, thoughts, flames ??

John Reed
{uunet,ucsd}!systech!johnr