[gnu.emacs.bug] Emacs hangs when run under /bin/sh

rajeev@SWISS-MOCHA.MIT.EDU (Rajeev Jayavant) (04/06/89)

We are running GNU Emacs version 18.53 under SunOS 4.0 on a Sun 3/280
system.  I believe that I have correctly built emacs from the
distribution on prep.  The problem is that emacs hangs indefinitely
when it is run from /bin/sh.  This would not be much of a problem if
not for the fact that things like /etc/vipw invoke emacs in this
manner.

Is this a known problem with 18.53 or am I just getting screwed by
SunOS 4.0?  I have not tried building 18.53 on another system yet, but
I can arrange to do that if need be.  Thanks for your help.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Rajeev Jayavant		   Quote: "Excuse me.  I've lost my marbles." (P. Opus)
ARPA: rajeev@caf.mit.edu    UUCP: ....!mit-eddie!caf!rajeev
							Rajeev

dieter@jupiter.nmt.edu (The Demented Teddy Bear) (04/18/89)

In article <8904051856.AA17243@swiss-mocha.MIT.EDU> rajeev@SWISS-MOCHA.MIT.EDU (Rajeev Jayavant) writes:
> We are running GNU Emacs version 18.53 under SunOS 4.0 on a Sun 3/280
> system.[...]  The problem is that emacs hangs indefinitely when it is
> run...

I just finished fighting with the exact same problem (down to the hardware
even).  I found that emacs would start fine from the shell (/bin/csh in
this case), but locked up when fired off by something like vipw, mail,
ingres, etc.  Here's a fix that works, but is far from elegant:

in emacs.c:
================================================================
# if defined (NMTHACK)
  {
    int pgrp;

    ioctl (fileno (stdin), TIOCGPGRP, &pgrp);
    if (getpid () != pgrp)
    {
	setpgrp (pgrp, pgrp);
    }
    else
    {
	ioctl (fileno (stdin), TIOCSPGRP, &pgrp);
    }
  }
# else
#ifdef BSD
  /* interrupt_input has trouble if we aren't in a separate process group.  */
  setpgrp (getpid (), getpid ());
#endif
# endif
================================================================
Note that I also moved the whole thing below the handling for ``-t'',
on the off-chance that file descriptors were getting hosed.  I haven't
checked yet, but I think the second ioctl is redundant.  Works for me....

Dieter
-- 
Welcome to the island.  You are number six.
dieter%nmt@relay.cs.net
dieter@jupiter.nmt.edu