Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2001 15:41:34 -0700 (PDT)
From:      mark@whistle.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/28109: [PATCH] Add "kill -s" to tcsh builtin for doc and POSIX compatibility
Message-ID:  <200106122241.f5CMfYD10147@whistle.com>

next in thread | raw e-mail | index | archive | help

>Number:         28109
>Category:       bin
>Synopsis:       [PATCH] Add "kill -s" to tcsh builtin for doc and POSIX compatibility
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 12 15:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mark Peek
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
Whistle Communications, Inc.
>Environment:
System: FreeBSD shark.whistle.com 4.3-RELEASE FreeBSD 4.3-RELEASE #5: Mon May 7 11:42:59 PDT 2001 root@shark.whistle.com:/usr/obj/usr/src/sys/INTELLISTATION_SMP i386

>Description:
Several man pages (such as mountd and exports) contain instructions to
use "kill -s HUP" to invoke behaviors within the commands. However, the
"-s" option is not implemented in the default tcsh shell builtin kill. This
can lead to users scratching their heads when they get an error message:
	"s: Unknown signal; kill -l lists signals."

>How-To-Repeat:
	/bin/tcsh -c "kill -s HUP 1"

>Fix:
This can be fixed a variety of ways:

1. Change the documentation to use the obsolete "kill -HUP" or the
   non-builtin "/bin/kill -HUP".
2. Apply the patch below to add "kill -s" to the tcsh command
3. Wait for the next version of tcsh to become available that (hopefully)
   will have the patch below contributed (I sent it to the tcsh mailing list).

I don't believe #1 should be done since that moves us backwards instead of
forwards. I'd like to see #2 but this might require moving this file off the
vendor branch. I'm just not sure about #3, since it would require the patch
to be applied to the tcsh source base and I'm unclear when the next tcsh
release will be available.

--------
Index: contrib/tcsh/sh.proc.c
===================================================================
RCS file: /home/ncvs/src/contrib/tcsh/sh.proc.c,v
retrieving revision 1.1.1.1.2.2
diff -u -r1.1.1.1.2.2 sh.proc.c
--- contrib/tcsh/sh.proc.c	2001/03/05 05:50:09	1.1.1.1.2.2
+++ contrib/tcsh/sh.proc.c	2001/06/12 22:20:36
@@ -1524,6 +1524,7 @@
 {
     register int signum, len = 0;
     register char *name;
+    Char *sigptr;
     extern int T_Cols;
     extern int nsig;
 
@@ -1544,17 +1545,26 @@
 	    xputchar('\n');
 	    return;
 	}
-	if (Isdigit(v[0][1])) {
-	    signum = atoi(short2str(v[0] + 1));
+	sigptr = &v[0][1];
+	if (v[0][1] == 's') {
+	    if (v[1]) {
+		v++;
+		sigptr = &v[0][0];
+	    } else {
+		stderror(ERR_NAME | ERR_TOOFEW);
+	    }
+	}
+	if (Isdigit(*sigptr)) {
+	    signum = atoi(short2str(sigptr));
 	    if (signum < 0 || signum > (MAXSIG-1))
 		stderror(ERR_NAME | ERR_BADSIG);
 	}
 	else {
 	    for (signum = 0; signum <= nsig; signum++)
 		if (mesg[signum].iname &&
-		    eq(&v[0][1], str2short(mesg[signum].iname)))
+		    eq(sigptr, str2short(mesg[signum].iname)))
 		    goto gotsig;
-	    setname(short2str(&v[0][1]));
+	    setname(short2str(sigptr));
 	    stderror(ERR_NAME | ERR_UNKSIG);
 	}
 gotsig:
Index: contrib/tcsh/tcsh.man
===================================================================
RCS file: /home/ncvs/src/contrib/tcsh/tcsh.man,v
retrieving revision 1.1.1.3.2.2
diff -u -r1.1.1.3.2.2 tcsh.man
--- contrib/tcsh/tcsh.man	2001/03/05 05:50:10	1.1.1.3.2.2
+++ contrib/tcsh/tcsh.man	2001/06/12 22:20:37
@@ -2851,8 +2851,11 @@
 .B kill \fR[\fB\-\fIsignal\fR] \fB%\fIjob\fR|\fIpid\fR ...
 .PD 0
 .TP 8
+.B kill \fR[\fB\-s \fIsignal\fR] \fB%\fIjob\fR|\fIpid\fR ...
+.TP 8
 .B kill \-l
-The first form sends the specified \fIsignal\fR (or, if none is given,
+The first and second forms sends the specified \fIsignal\fR (or, if none
+is given,
 the TERM (terminate) signal) to the specified jobs or processes.
 \fIjob\fR may be a number, a string, `', `%', `+' or `\-' as described
 under \fBJobs\fR.
@@ -2862,7 +2865,7 @@
 to the current job.  If the signal being sent is TERM (terminate)
 or HUP (hangup), then the job or process is sent a
 CONT (continue) signal as well.
-The second form lists the signal names.
+The third form lists the signal names.
 .PD
 .ig \" Obsolete tcsh command
 .TP 8
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106122241.f5CMfYD10147>