[PATCH v2] inotifyd: -x: new option

Laurent Bercot ska-dietlibc at skarnet.org
Sat Oct 17 10:38:35 UTC 2015


On 17/10/2015 09:47, Denys Vlasenko wrote:
> If you have a program which does not know that it is being run by inotifyd,
> you can create a shim which does know that:
>
> #!/bin/sh
> PROG "$@"
> test "$?" = 111 && kill $PPID

  Yes. You still have to know which program needs it and which one does
not, and you have to run that shim for every program that does. This
is code - a longer code path than Bartosz's patch, and that has to be
maintained separately.


> This does not sound like technical argument, it's an aesthetic one.

  Indeed, but aesthetics usually translate to very tangible, technical
benefits: either shorter code paths, or better maintainability. Here,
it translates to both.


> You propose to add complexity to inotifyd because it's looks "cleaner".
> I don't see it as "cleaner", I see both ways as legitimate.
> But your way requires additional code.

  It requires additional code in inotifyd, yes. But it factorizes code
that you would have had to run anyway, in scripting the child. It also
allows you to make the natural assumption that a child cannot impact
its parent (except by returning a certain exit code), which I find
makes scripts easier to understand, so more maintainable. It is not
intuitive, when reading the script, to think "ah, inotifyd can be
killed by its child" - the mechanism works, and is legitimate as you
put it, but the information flow is more convoluted and requires more
effort to understand than just following the exit codes trail.

-- 
  Laurent



More information about the busybox mailing list