[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash vs. screen vs. SIGINT
From: |
Thomas Schwinge |
Subject: |
Re: bash vs. screen vs. SIGINT |
Date: |
Tue, 6 Oct 2009 23:43:37 +0200 |
User-agent: |
Mutt/1.5.11 |
Hello!
On Sat, Oct 03, 2009 at 06:06:35PM +0200, I wrote:
> There are issues with the bash 4.0 packages, and new Debian screen
> packages w.r.t. handling of SIGINT. I don't think that glibc is at
> fault, but instead bash and screen should be looked at. Details are at
> <http://www.bddebian.com:8888/~hurd-web/open_issues/bash_vs_screen_vs_sigint/>.
Some data about this issue: C-c doesn't make it to the foreground process
in a screen session.
* in a *screen* session (Debian package 4.0.3-14)
* shell prompt: **no reaction (nothing printed)**; `$?` thus is
**unchanged**.
* `sleep 10` running: **`^C` printed**, SIGINT is **not** sent.
This is a issue in the screen package, that arised when the Debian screen
and GNU/kFreeBSD guys made screen work for them (c.f.
<http://bugs.debian.org/522689>).
This is the old code, from tty.c:
int
fgtty(fd)
int fd;
{
#ifdef BSDJOBS
int mypid;
mypid = getpid();
/* The next lines should be obsolete. Can anybody check if they
* are really needed on the BSD platforms?
*
* this is to avoid the message:
* fgtty: Not a typewriter (25)
*/
# if defined(__osf__) || (BSD >= 199103) || defined(ISC)
if (separate_sids)
setsid(); /* should be already done */
# ifdef TIOCSCTTY
ioctl(fd, TIOCSCTTY, (char *)0);
# endif
# endif
# ifdef POSIX
if (separate_sids)
if (tcsetpgrp(fd, mypid))
{
debug1("fgtty: tcsetpgrp: %d\n", errno);
return -1;
}
# else /* POSIX */
[...]
#endif /* BSDJOBS */
return 0;
}
... and this is their new version:
int
fgtty(fd)
int fd;
{
#ifdef BSDJOBS
int mypid;
mypid = getpid();
/*
* Under BSD we have to set the controlling terminal again explicitly.
*/
# if defined(__FreeBSD_kernel__) && defined(TIOCSCTTY)
ioctl(fd, TIOCSCTTY, (char *)0);
# endif
# ifdef POSIX
if (separate_sids)
if (tcsetpgrp(fd, mypid))
{
debug1("fgtty: tcsetpgrp: %d\n", errno);
return -1;
}
# else /* POSIX */
[...]
#endif /* BSDJOBS */
return 0;
}
The setsid call indeed doesn't seem to be needed / is done before, but it
seems that on the Hurd we also still need the TIOCSCTTY one -- if I cover
__GNU__ in the #if, then screen works again as expected. Is this the
correct thing to do then?
The whole screen code that I read (the job control / controlling terminal
/ etc. stuff) is a bit of a mess, and my undestanding of these topics
also is mostly non-existent...
On <http://www.bddebian.com/~hurd-web/open_issues/screen/> I recorded all
the screen issues that I saw.
Regards,
Thomas
signature.asc
Description: Digital signature