Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Sep 2001 19:58:49 -0500
From:      Stephen Montgomery-Smith <stephen@math.missouri.edu>
To:        Giorgos Keramidas <charon@labs.gr>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: killall longprocname
Message-ID:  <3B942749.9E172F45@math.missouri.edu>
References:  <3B93EF80.37F0670A@math.missouri.edu> <20010904010327.A4436@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
Don't be too hasty to submit a PR.  The code in 4.4-STABLE looks like

                                regfree(&rgx);
                        } else {
                                if (strcmp(thiscmd, cmd) != 0)
                                        matched = 0;
                        }

suggesting that this "bug" may have been fixed in 5.0-CURRENT (really a
strncmp would be the obvious way to fix the above code).  So you should
first check to see if in CURRENT that 
killall abcdefghijklmnopqrstuvwxyz
would work.  Of course so would
killall abcdefghijklmnopqraaaaaaaa
so there should still be an addition to the man page to explain this.

Thanks, Stephen


Giorgos Keramidas wrote:
> 
> From: Stephen Montgomery-Smith <stephen@math.missouri.edu>
> Subject: killall longprocname
> Date: Mon, Sep 03, 2001 at 04:00:48PM -0500
> 
> > If I create and run a program called abcdefghijklmnopqrstuvwxyz and then
> > try to kill it using killall, the only command that seems to work is:
> > killall abcdefghijklmnop
> > that is, it looks like killall only looks at the first 16 characters.  I
> > don't see anything about this is the man page.  Is this the appropriate
> > behavior?
> 
> Actually, the source of killall.c uses MAXCOMLEN as the maximum number
> of characters to compare.  From the 5.0-CURRENT sources I read near
> line 321 the following:
> 
> 319                            regfree(&rgx);
> 320                    } else {
> 321                            if (strncmp(thiscmd, cmd, MAXCOMLEN) != 0)
> 322                                    matched = 0;
> 323                    }
> 
> And <sys/param.h> defines MAXCOMLEN as 19 in:
> 
> 72 #include <sys/syslimits.h>
> 73
> 74 #define      MAXCOMLEN       19              /* max command name remembered */
> 75 #define      MAXINTERP       32              /* max interpreter file name length */
> 76 #define      MAXLOGNAME      17              /* max login name length (incl. NUL) */
> 
> This is not documented in the manpage though.  Perhaps, a send-pr(1)
> with a correction is proper(?).  If you, Stephen, have no time to file
> a bug report with the fix for the manpage, I can do it tomorrow.
> 
> -giorgos
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
Stephen Montgomery-Smith
stephen@math.missouri.edu
http://www.math.missouri.edu/~stephen

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B942749.9E172F45>