[Toybox] [PATCH] killall should kill scripts too.

Rob Landley rob at landley.net
Sat Dec 23 11:58:42 PST 2017


On 12/20/2017 12:34 PM, enh wrote:
> thanks. though you have though managed to convince me that the
> situation is already a mess.

It keeps getting messier. I'm trying to write proper test cases for
this, and it's being... Sigh.

  $ mkdir sub1 sub2
  $ cp "$(which sleep)" sub1/sleep
  $ ln sub1/sleep sub2/sleep
  $ sub1/sleep 999 &
  [1] 2096
  $ sub2/sleep 998 &
  [2] 2099
  $ pidof sub1/sleep
  2096
  $ pidof $PWD/sub1/sleep
  2099 2096

So the ubuntu version is matching argv[0] for a relative path and inodes
for an absolute path. How do I know the absolute path is matching inodes?

  $ rm sub2/sleep
  $ cp sub1/sleep sub2
  $ sub1/sleep 999 & sub2/sleep 998 &
  [1] 2295
  [2] 2296
  $ pidof $PWD/sub1/sleep
  2295

And the sad part is: ubuntu's pidof and ubuntu's killall aren't using
the same %*(#(%&# logic!

  $ cd sub2
  $ pidof ../sub1/sleep
  $ killall ../sub1/sleep
  [1]-  Terminated              sub1/sleep 999  (wd: ~/toybox/clean)
  (wd now: ~/toybox/clean/sub2)
  $

So that's nice.

The question is which subset of this behavior to implement. I'm leaning
towards just keeping what I've already done and calling it good, but I'm
trying to write tests that both the host version and the toybox version
pass, while testing all the behavioral corner cases I care about,
without the script equivalent of #ifdeffery.

So how's your holiday going? :)

> i don't think the top "memory corruption if left running long enough"
> crashes are fixed, but i've only ever seen a few crashes. i've just
> built a ToT toybox with asan for my laptop and i'll leave it running
> during the day.

Did it? I haven't seen this one, and it's the first I remember hearing
of it...

Rob



More information about the Toybox mailing list