Since util-linux/util-linux@6c87a3ac5e (taskset: Accept 0 pid for current
process), util-linux's taskset has accepted a 0 PID for the taskset
process.
Toybox has always had this behavior, inherited from sched_getaffinity(2)
and sched_setaffinity(2).
https://www.man7.org/linux/man-pages/man2/sched_getaffinity.2.html
Document the zero PID behavior and use it to simplify the tests.
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
While both gcc 12.2 and clang 18.0 compiled weak and non-weak versions
of the same symbol in the same file just fine, newer versions only work
if the weak symbol is in a different compilation unit than the non-weak
one. Otherwise they error out on the "redefinition".
"make defconfig" calls kconfig twice, and the first one (kconfig -h)
was consuming the KCONFIG_ALLCONFIG=<(echo blah) input so the actual
defconfig generation (kconfig -d) didn't see the PENDING overrides.
with toys.rebound to continue and accept additional input after error file,
reduce error message granularity (it worked or it didn't),
mark more functions static, use toybuf for input.
Fix tests to not look for specific error messages (fixes TEST_HOST).
Move sh_process allocation out of expand_redir() and have caller allocate
and supply it, so multiple expand_redir() calls can append to the
same argv[] and filehandle unredirect context.
Move argv[0] out of ff->arg into TT.argv0 (because $0 is special: shift
and $* don't include it, set can't update it, source and function calls
don't change it...)
Rename call_function() to add_fcall(), because sh_function is function()
definitions and sh_fcall is call stack.
Remove pp->envlen, and replace pp->flags/PFLAG_NOT with pp->not.
Make sh_fcall more sparse: instead of copying fields from parent context
search for them with find_fcall() (convenience wrapper: FIND_FF()) and
get_lineno(). Having one copy greatly simplifies updating the values.
Note: run_command() no longer returns NULL: pp->exit will be nonzero if
setup failed.
response line on the control channel, so ftp_line() having a -1 option
to not read a response line is wrong, and gets the parsing out of sync.
(But must=0 is ok, that means read and return it, but don't require a
specific value.)
This resulted in "ftpget HOST filename" successfully fetching the file,
but reporting error anyway.
when a second config symbol isn't defined. Use this for various LSM -Z
flags, PASSWD_SAD, sort -g, and wget's https support. This replaces the
old help text merging scripts/config2help.c used to do.
The annotation is a leading !, which removes the next char from usage:
lines and the whole line from the rest of the help text. The ! is always
removed, and the data it marks is only shown if the argument to
TOYFLAG_MOREHELP() is true at compile time.
In theory this plumbing should drop out when not used, like lib/args.c.
With `conv=nocreat` set O_CREAT will not be set when
creating the output file, causing an error if of does
not exist.
Test: dd if=/dev/zero of=/tmp/doesnotexist conv=nocreat count=1