[Toybox] Fix, killall is not allowed to kill itself

Rob Landley rob at landley.net
Sun Dec 23 22:01:21 PST 2012


On 12/23/2012 11:44:27 PM, David Seikel wrote:
> On Sun, 23 Dec 2012 23:25:46 -0600 Rob Landley <rob at landley.net>  
> wrote:
> 
> > On 12/23/2012 08:45:07 PM, David Seikel wrote:
> > > > > Like rm'ing something that does not exist, the end result is  
> the
> > > > > same, except for the useless error.
> >
> > Using the host version on Ubuntu:
> >
> >    $ rm doesnotexist
> >    rm: cannot remove `doesnotexist': No such file or directory
> >
> > You're thinking rm -f maybe?
> >
> > > > >  The thing does not exist,
> > > > > killall is no longer running.  The error message is
> > > > > superfluous,
> > > as
> > > > > the result you wanted is exactly what you get.
> > > >
> > > > I think the objection is that PIDs aren't monotonic (the PID
> > > > namespace wraps), so if you kill things in increasing PID order
> > > > this killall instance isn't guaranteed to be last so it won't
> > > > necessarily kill everything it should.
> > >
> > > A valid objection for not killing yourself until you are done
> > > killing everyone else.  No excuse for an error message though,  
> once
> > > killall is done, the requested task is accomplished, that's not an
> > > error, that's success.
> >
> > Using the host version in ubuntu:
> >
> >    $ killall doesnotexist
> >    doesnotexist: no process found
> >
> > You're thinking killall -q maybe? Which toybox implements?
> >
> >    ./toybox killall -q killall
> 
> Yes, the "killall killall" case that this thread is all about.

"killall -q doesnotexist" works the exact same way.

> I'm just ranting against the fact that getting the end result you  
> asked
> for (the thing you are trying to delete does not exist, the thing you
> are trying to kill is dead) is considered an error.  The state of
> things is precisely how you wanted them to be, what's the point of
> declaring that as an error condition?

You requested an action that could not be performed. This is an error.  
There is a flag to indicate that you do not consider it an error. This  
is the existing design of _both_ tools.

I'm not seeing a problem here.

> It's just a rant, nothing more.  I know toybox will continue to stick  
> to
> the the standards.  I'm allowed to point out that I think the  
> standards
> are stupid some times.  I think it's particularly hilarious that the
> only way to "successfully" remove something that does not exist is to
> forcefully remove it.

I note that neither the "unlink" nor "rmdir" commands care about the  
target's permission flags, so pausing to warn you about deleting them  
is an artificial check in the rm command. All the -f flag does is not  
tell you about anything that isn't an actual failure. So you could just  
as easily say "-f" is "only report failures".

> Kinda like beating a dead horse, by nuking it
> from orbit, the horse isn't any more dead.  lol

In this case, the horse is alive and well.

Rob
 1356328881.0


More information about the Toybox mailing list