Re: bin/40282: [patch] kill(1) has bad error checking for command line parameters

View: New views
2 Messages — Rating Filter:   Alert me  

Re: bin/40282: [patch] kill(1) has bad error checking for command line parameters

by Jilles Tjoelker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following reply was made to PR bin/40282; it has been noted by GNATS.

From: Jilles Tjoelker <jilles@...>
To: bug-followup@..., oleg@...
Cc:  
Subject: Re: bin/40282: [patch] kill(1) has bad error checking for command
        line parameters
Date: Sat, 7 Nov 2009 16:21:46 +0100

 I think the idea of aborting on syntax errors makes sense, but aborting
 on a kill(2) error seems to go too far. I have found various shells
 (tcsh, real ksh) that stop processing a kill builtin if they encounter
 an invalid pid (if there were any previous valid pids, signals will have
 been sent), but have not found any that stop processing if a kill(2)
 returns an error.
 
 By the way, do not imply anything about command behaviour from
 /usr/bin/which. sh(1) and bash(1) do not have a which(1) builtin, so
 /usr/bin/which will be used, which does not know about shell builtins.
 It just happens to be the case that sh(1) does not have a kill builtin
 (although that may change in the future) and bash's kill builtin handles
 errors the same way as our /bin/kill. You can use 'type' for accurate
 information in these shells.
 
 --
 Jilles Tjoelker
_______________________________________________
freebsd-bugs@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@..."

Parent Message unknown Re: bin/40282: [patch] kill(1) has bad error checking for command line parameters

by Jilles Tjoelker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following reply was made to PR bin/40282; it has been noted by GNATS.

From: Jilles Tjoelker <jilles@...>
To: bug-followup@..., oleg@...
Cc:  
Subject: Re: bin/40282: [patch] kill(1) has bad error checking for command
        line parameters
Date: Sun, 8 Nov 2009 18:10:31 +0100

 --W/nzBZO5zC0uMSeA
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 So I suggest this patch (EX_USAGE vs 1 can be changed separately).
 
 --
 Jilles Tjoelker
 
 --W/nzBZO5zC0uMSeA
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="kill-stop-on-synerror.patch"
 
 Index: bin/kill/kill.c
 ===================================================================
 --- bin/kill/kill.c (revision 198703)
 +++ bin/kill/kill.c (working copy)
 @@ -123,10 +123,9 @@
 
  for (errors = 0; argc; argc--, argv++) {
  pid = strtol(*argv, &ep, 10);
 - if (!**argv || *ep) {
 - warnx("illegal process id: %s", *argv);
 - errors = 1;
 - } else if (kill(pid, numsig) == -1) {
 + if (!**argv || *ep)
 + errx(1, "illegal process id: %s", *argv);
 + else if (kill(pid, numsig) == -1) {
  warn("%s", *argv);
  errors = 1;
  }
 
 --W/nzBZO5zC0uMSeA--
_______________________________________________
freebsd-bugs@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@..."