[Toybox] [PATCH] taskset: Document and add test for 0 PID
Rob Landley
rob at landley.net
Sat Jul 5 12:27:10 PDT 2025
On 7/3/25 10:12, Jesse Rosenstock wrote:
> Note that toybox and util-linux show different output. I'm not sure if
> this should be considered a bug or not.
>
> % ./toybox taskset 1 ./toybox taskset -p 0
> pid 0's current affinity mask: 1
> % ./taskset 1 ./taskset -p 0
> pid 2140985's current affinity mask: 1
I'm assuming the one you're running out of the current directory is
util-linux instead of the toybox version. Why you're running the
util-linux version out of the current directory instead of the $PATH I
couldn't tell you. But on my debian-ish system:
$ toybox taskset 1 toybox taskset -p 0
pid 0's current affinity mask: 1
$ taskset 1 taskset -p 0
taskset: bad usage
Try 'taskset --help' for more information.
$ taskset --version
taskset from util-linux 2.38.1
I'm happy to change the behavior here, but am unclear on what the right
behavior is. Something I hadn't noticed when I applied your patch was:
$ TEST_HOST=1 make test_taskset
scripts/test.sh taskset
taskset: bad usage
Try 'taskset --help' for more information.
FAIL: taskset set mask to all
echo -ne '' | '(taskset $MASK taskset -p 0 | sed "s/.*: //")'
--- expected 2025-07-05 14:15:56.329786399 -0500
+++ actual 2025-07-05 14:15:56.329786399 -0500
@@ -1 +0,0 @@
-f
make: *** [.singlemake:929: test_taskset] Error 1
The host no longer passes those tests on my laptop.
(Always fun when there's no specification, just a magic implementation
we have to use as reference where "whatever it does must be the correct
behavior, and then THAT behavior is inconsistent.)
Do you know which util-linux version changed util-linux's behavior for
this command?
Rob
P.S. Filtering host tests so the ones known not to pass on a specific
host environment don't get run is an issue that's come up a lot before,
and I'm not sure there IS a good general purpose solution. There's a lot
of checks for macos, but bash is also full of version skew over the
years, ls changed its default output-to-tty from -q to -b a few years
back (so we had to do commit 007af3537d18 to match the new one), Elliott
got bit last year by od changing the whitespace in its output (commit
f4ab441ca363)... Testing is HARD.
More information about the Toybox
mailing list