unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
Cc: angeloff@acm.org
Subject: Re: [angeloff@acm.org: Emacs bug with Solaris 9 (only)]
Date: Sat, 15 Feb 2003 13:52:30 +0100 (CET)	[thread overview]
Message-ID: <200302151346.h1FDkw3B005865@stubby.bodenonline.com> (raw)
In-Reply-To: "from (env: jhd) at Feb 15, 2003 01:46:12 pm"

[-- Attachment #1: Type: text/plain, Size: 2309 bytes --]

> In case anyone here can fix it...
> 
> ------- Start of forwarded message -------
> X-Authentication-Warning: host132.grad.iit.edu: angeloff owned process doing
> 	-bs
> Date: Wed, 22 Jan 2003 00:23:14 -0600 (CST)
> From: Nikolay Angeloff <angeloff@acm.org>
> X-X-Sender: <angeloff@host132.grad.iit.edu>
> To: <bug-gnu-emacs@prep.ai.mit.edu>
> cc: rms-assist@gnu.org
> Subject: Emacs bug with Solaris 9 (only)
> Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
> 
> In short: quit-process, stop-process, get-process etc.
> do not work when emacs is executed (and compiled) in
> Solaris 9, but work just fine when the same compiled
> code is scp-ed to a Solaris 8 machine.
> 

It seems that ioctl TICSIGNAL is broken in Solaris 9.  Emacs uses that
to send signals to the slave side of the pty.  I propose that Emacs
check the return code of ioctl and falls back to killing the process
group if the ioctl fails (see patch below).

Another thing is that getting the tty foreground process group does
not work when using the master side file descriptor, the slave side
descriptor must be used.  This is true for Solaris 8 also, but there
TICSIGNAL works so it is harder to notice.'

In process there are two places that gets the terminal process group,
process_send_signal and Fprocess_running_child_p.  Both places look 
like this:

  if (!NILP (p->subtty))
    ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
  else
    ioctl (XINT (p->infd), TIOCGPGRP, &gid);

Now, reading the code it seems to me that p->subtty is unconditionally
set to Qnil when the fork of the subprocess succeeds, so the first
ioctl will never be executed.  Am I missing something?

I propose reopening the slave side in Emacs to get the process group.
This works in Solaris 8 and 9 and should have no sideeffects
on other systems.

The attached patch fixes just one place, a better patch would be to
introduce an emacs_get_tty_pgrp or something and call that from
these two places.  The attached patch fixes the fact that you can not
do
  M-x shell
  sleep 12
  C-c C-c

and have the sleep interrupted.  If this approach is acceptable, I can
make a better patch.  Also, this should go into RC (the patch is for RC).

But I would like to know if the "if (!NILP (p->subtty))" code ever will
be TRUE before committing anything.

	Jan D.


[-- Attachment #2: process.c.diff --]
[-- Type: text/plain, Size: 1172 bytes --]

*** process.c	ons feb 12 22:24:25 2003
--- emacsRC/emacs/src/process.c	lör feb 15 13:22:21 2003
***************
*** 3755,3760 ****
--- 3755,3772 ----
  	else
  	  err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);
  
+ 	if (err == -1 && NILP (p->subtty) && ! NILP (p->tty_name))
+ 	  {
+ 	    int fd;
+ 	    fd = emacs_open (XSTRING (p->tty_name)->data, O_RDONLY, 0);
+ 
+ 	    if (fd != -1)
+ 	      {
+ 		err = ioctl (fd, TIOCGPGRP, &gid);
+ 		emacs_close (fd);
+ 	      }
+ 	  }
+ 
  #ifdef pfa
  	if (err == -1)
  	  gid = - XFASTINT (p->pid);
***************
*** 3821,3827 ****
    /* gid may be a pid, or minus a pgrp's number */
  #ifdef TIOCSIGSEND
    if (!NILP (current_group))
!     ioctl (XINT (p->infd), TIOCSIGSEND, signo);
    else
      {
        gid = - XFASTINT (p->pid);
--- 3833,3845 ----
    /* gid may be a pid, or minus a pgrp's number */
  #ifdef TIOCSIGSEND
    if (! NILP (current_group))
!     {
!       if (ioctl (XINT (p->infd), TIOCSIGSEND, signo) == -1)
! 	{
! 	  EMACS_KILLPG (gid, signo);
! 	  fprintf(stderr, "Kill 2: %d\n", gid);
! 	}
!     }
    else
      {
        gid = - XFASTINT (p->pid);

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

             reply	other threads:[~2003-02-15 12:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-15 12:52 Jan D. [this message]
2003-02-17  7:19 ` [angeloff@acm.org: Emacs bug with Solaris 9 (only)] Richard Stallman
2003-02-17 13:21   ` Jan D.
2003-02-17 20:38     ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2003-02-16  5:54 Markus Rost
2003-02-15 21:59 Jan D.
2003-01-23 20:01 Markus Rost
2003-01-23  8:01 Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200302151346.h1FDkw3B005865@stubby.bodenonline.com \
    --to=jan.h.d@swipnet.se \
    --cc=angeloff@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).