Don't hang the shell when you use the builtin "kill" command with backticks.

From mp@freebsd via downsj; fix is incorporated in next upstream release 6.16
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2007-07/msg00522.html
This commit is contained in:
sthen 2009-06-29 00:38:27 +00:00
parent 7bae051729
commit 4d6286ac4a
2 changed files with 45 additions and 4 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.42 2007/09/15 21:17:25 merdely Exp $
# $OpenBSD: Makefile,v 1.43 2009/06/29 00:38:27 sthen Exp $
COMMENT= extended C-shell with many useful features
DISTNAME= tcsh-6.15.00
PKGNAME= ${DISTNAME}p0
CATEGORIES= shells
HOMEPAGE= http://www.tcsh.org/

View File

@ -1,6 +1,10 @@
$OpenBSD: patch-sh_proc_c,v 1.2 2007/05/27 18:04:47 naddy Exp $
--- sh.proc.c.orig Wed Sep 27 10:59:04 2006
+++ sh.proc.c Sat May 26 15:36:43 2007
$OpenBSD: patch-sh_proc_c,v 1.3 2009/06/29 00:38:27 sthen Exp $
hunks in pkill() from http://people.freebsd.org/~mp/tcsh_kill.patch
fix a problem with kill and backticked expressions
--- sh.proc.c.orig Mon Jun 29 01:22:54 2009
+++ sh.proc.c Mon Jun 29 01:23:09 2009
@@ -366,6 +366,7 @@ found:
#ifdef notdef
jobflags & PAEXITED ||
@ -9,3 +13,39 @@ $OpenBSD: patch-sh_proc_c,v 1.2 2007/05/27 18:04:47 naddy Exp $
!eq(dcwd->di_name, fp->p_cwd->di_name))) {
/* PWP: print a newline after ^C */
if (jobflags & PINTERRUPTED) {
@@ -1428,13 +1429,6 @@ pkill(Char **v, int signum)
pid_t pid;
Char *cp, **vp, **globbed;
- pchild_disabled++;
- cleanup_push(&pchild_disabled, disabled_cleanup);
- if (setintr) {
- pintr_disabled++;
- cleanup_push(&pintr_disabled, disabled_cleanup);
- }
-
/* Avoid globbing %?x patterns */
for (vp = v; vp && *vp; vp++)
if (**vp == '%')
@@ -1444,6 +1438,12 @@ pkill(Char **v, int signum)
globbed = v;
cleanup_push(globbed, blk_cleanup);
+ pchild_disabled++;
+ cleanup_push(&pchild_disabled, disabled_cleanup);
+ if (setintr) {
+ pintr_disabled++;
+ cleanup_push(&pintr_disabled, disabled_cleanup);
+ }
while (v && (cp = *v)) {
if (*cp == '%') {
@@ -1516,7 +1516,7 @@ pkill(Char **v, int signum)
cont:
v++;
}
- cleanup_until(&pchild_disabled);
+ cleanup_until(globbed);
if (err1)
stderror(ERR_SILENT);
}