5628 Commits

Author SHA1 Message Date
Rob Landley
a61f9fe68f Release 0.8.13 0.8.13 2025-10-14 11:45:35 -05:00
Rob Landley
a72476beef Fix test. 2025-10-08 17:14:58 -05:00
Rob Landley
ab1a2529f3 Update scripts/prereq prebuilt headers for xargs -a 2025-10-07 12:46:06 -05:00
Rob Landley
f4896225d9 Remove printf -r before release. The bar for nonstandard extensions
should be higher than that, and wrapping a "while true" loop around
echo -e 'abc\0def' isn't a huge lift.
2025-10-07 12:26:52 -05:00
Rob Landley
821d8ca155 Tweak roadmap. 2025-10-01 16:21:37 -05:00
Rob Landley
b9c511174a Remove leftover test from the prefix logic rewrite. 2025-10-01 15:59:37 -05:00
Rob Landley
6bc1984355 Cleanup prompt logic. 2025-10-01 15:58:40 -05:00
Avery Terrel
557ad10d46 sh: implement \dD{}tT@AuvVW prompt control characters 2025-09-30 09:02:40 -05:00
Rob Landley
e83aa17ccc Minor cleanup: reorder some functions and mark others static. 2025-09-30 09:01:35 -05:00
Elliott Hughes
7d965b43da xargs: implement -a. 2025-09-17 23:24:31 -05:00
Rob Landley
73bce5b488 Convert testing->testcmd. 2025-09-08 14:10:32 -05:00
Rob Landley
1bab876006 Add test for write falure. 2025-09-08 14:02:15 -05:00
Utsav Munendra
0f5e2f0ace xsendfile_len() to exit with error if underlying write fails
cp currently will exit with success even if the underlying
write syscall fails with an error. Fixing this behavior.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-09-08 13:56:29 -05:00
Zikai Chen
494f9c4efc dhcp: Add a new option to unset broadcast bit
In some network environment, we would like the dhcp client to receive
unicast offer/ack packets. This requires the broadcast bit to be unset.
However, the current implementation always sets this bit. This patch
adds a new option -u to unset broadcast bit to enable unicast offer/ack.
2025-09-08 13:49:20 -05:00
Rob Landley
62284825a7 Jesse Rosenstock wants taskset to work with an arbitrary number of
leading zeroes for some reason, so take the rightmost 8k of mask data
and test with leading zeroes. (It could instead specifically skip
leading zeroes, but would still have to check sizeof(toybuf) anyway.)

Again, the 6.16 kernel can only set NR_CPUS to 8k (1/4 of the bits in
toybuf) for 2 architectures (x86-64 and powerpc64, and ARM64 maxes out
at 4k (1/8 of toybuf). Last I checked nobody's made hardware anywhere
near that: they thought they might 20 years ago but NUMA didn't scale.
Beowulf clusters existed back in the 1990s and if you really want to
have a cluster mmap() shared memory from network storage you can just do
that and address contentional manually (with manual flock and madvise or
your own bespoke mechanism), or create data stores like riak, or...
2025-09-05 16:59:37 -05:00
Rob Landley
be86489b16 Update prerequisite build. 2025-08-22 12:55:53 -05:00
Rob Landley
5806d2cfdb Fix allnoconfig to write out values changed by KCONFIG_ALLCONFIG. 2025-08-22 12:39:21 -05:00
Rob Landley
a3e5f1b1ea Passing a 64 bit value with syscall() has problems in certain older
syscalls on some 32 bit architectures, and this one is used as the
_example_ in the the "Architecture-specific requirements" section of
"man 2 syscall".

Some 32-bit processors can only use 64 bit values in even register
pairs. Eight old syscalls (fadvise64_64, ftruncate64, posix_fadvise,
pread64, pwrite64, readahead, sync_file_range, and truncate64) didn't
arrange the argument order to naturally align, so required padding on
32-bit arm eabi, mips oabi, powerpc, parisc, and xtensa.

The libc wrapper inserts this padding when necessary, and using that is
less ugly than architecture specific whack-a-mole in toybox, even
working around glibc's refusal to provide the prototype unless we
declare Linux to be somehow owned by the Free Softare Foundation (which
was why it was using the syscall directly before).
2025-08-14 19:06:58 -05:00
Rob Landley
7932d08016 More comments, minor cleanups. 2025-08-14 17:32:44 -05:00
Elliott Hughes
97506b9b9c ip: add ip6gre.
Also try to clean up the #ifdefery. These things have been in the kernel
headers since 2012, so let's assume that -- other than the glibc
header/uapi header conflict -- we can get everything we need now.
2025-08-07 05:28:55 -05:00
Rob Landley
b8186ba3c4 Don't output blank header line, such as for "ps -o psr= $$" 2025-08-04 12:50:20 -05:00
Rob Landley
907eb01f99 Update prereq flags.h for chmod -c 2025-08-02 05:02:59 -05:00
Rob Landley
15eea69acd Cleanup pass on lsusb -t 2025-07-26 09:04:54 -05:00
Tai Groot
6bc987b4b9 update crontab ownership 2025-07-24 21:24:37 -05:00
Jignesh Patel
06329d54bb lsusb: add -t option for tree format display
Added tree format display similar to usbutils lsusb -t, showing USB
device hierarchy.
2025-07-21 19:10:50 -05:00
Rob Landley
fbfb6b2feb For single builds, disable TOYFLAG_HELP and TOYFLAG_SUID for commands
that don't need them.
2025-07-19 21:56:32 -05:00
Rob Landley
6f8ea8aafd Minor cleanup. 2025-07-19 21:03:33 -05:00
Rob Landley
791efbf86f setgid() should use gid not uid. (Spotted by ttiinn.)
Only used by login and su outside of pending, so went unnoticed in the
absence of mkroot tests running as root.
2025-07-17 05:37:50 -05:00
Rob Landley
209b2bf85e Make taskset with no args print current mask 2025-07-08 15:42:47 -05:00
Rob Landley
7e65c1fb80 Exclude octal from atolx(), just detect hex and decimal. 2025-07-07 20:46:45 -05:00
Rob Landley
d632ad4aae Minor cleanup, and add -a short option for --all 2025-07-05 15:58:54 -05:00
Jesse Rosenstock
40a81414b0 taskset: Document and add test for 0 PID
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
2025-07-04 15:25:34 -05:00
Rob Landley
635f1e0391 Work around another gcc bug, where --as-needed breaks libasan. This
dies with a null pointer dereference calling crypt():

gcc -fsanitize=address -static-libasan -xc - -Wl,--as-needed -lcrypt \
  <<<$'#include<crypt.h>\nint main(void){crypt("one", "two");}' &&
  ./a.out
2025-07-02 13:04:51 -05:00
Rob Landley
4bf4509984 Go back to the #ifdefs to work around compiler regressions.
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".
2025-07-02 12:47:17 -05:00
Rob Landley
5ab6c0d5e2 Teach mkroot/mkroot.sh CROSS= to accept multiple comma separated targets. 2025-07-01 17:38:40 -05:00
Rob Landley
1ed82ade2f Fix mkroot.
"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.
2025-07-01 17:24:47 -05:00
Rob Landley
9d27aba79e Remove poke() and friends, just inline the one caller using memcpy(). 2025-07-01 14:30:22 -05:00
Rob Landley
17d77a264a Clang is persnickety about attribute order. 2025-06-30 08:58:10 -05:00
Rob Landley
07a422c559 Xz cleanup: inline several init functions, use xmalloc() and error_exit()
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).
2025-06-28 20:18:06 -05:00
Elliott Hughes
1809240ad7 dd: add iflags=direct too.
The way this is going, I'll be back with more later, but for now I'm
still just adding each flag as it's explicitly requested.
2025-06-27 15:02:13 -05:00
Rob Landley
94a0d2b7d7 xzcat cleanup: reorder to remove some function prototypes and
predeclarations, yank unused xz_ret states (using xmalloc() to eliminate
one and just ignore the other), and memeq() is just !memcmp()
2025-06-27 13:21:01 -05:00
Rob Landley
70157e71bb Use weak symbol instead of #else skipping build. 2025-06-24 13:58:32 -05:00
Rob Landley
105a72fd53 Jesse Rosenstock pointed out that long masks would run past toybuf. 2025-06-23 15:16:01 -05:00
Rob Landley
77cb95ab94 Add taskset tests. 2025-06-23 14:59:16 -05:00
Rob Landley
d6bc6b1d8a Add ARM64 BCJ decoder, from Lassee Collin's xz-embedded commit 89094f05f02b 2025-06-22 20:50:24 -05:00
Rob Landley
849e1c2833 Several minor fixes from upstream public domain repo, adapted from
xz-embedded commits 40d291b609d0 f6d1f58f36cd 82078b610912 cfc1499e9fc2

Thanks to Oliver Webb for the triage.
2025-06-22 20:14:29 -05:00
Rob Landley
8433c5d9a4 Redo prefix assignment logic so ! and redirects can interleave.
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.
2025-06-22 18:28:14 -05:00
Rob Landley
3a5f39b957 Whitespace. 2025-06-22 00:53:21 -05:00
Rob Landley
ecfe2ee305 Don't have help recommend -tL until fixed (there's already a TODO about it). 2025-06-20 13:14:59 -05:00
Rob Landley
8c66925859 Add KCONFIG_ALLCONFIG support (which mkroot needs). 2025-06-11 10:16:32 -05:00