From 122bbe602f50b7fe747751370035f6fd55e674d0 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 8 Apr 2024 20:29:53 -0500 Subject: Version 0.8.11 --- toys.h | 2 +- www/header.html | 2 +- www/news.html | 298 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 300 insertions(+), 2 deletions(-) diff --git a/toys.h b/toys.h index 88b7a837..94d0c4b5 100644 --- a/toys.h +++ b/toys.h @@ -141,5 +141,5 @@ extern char **environ, *toybox_version, toybuf[4096], libbuf[4096]; #ifndef TOYBOX_VENDOR #define TOYBOX_VENDOR "" #endif -#define TOYBOX_VERSION "0.8.10"TOYBOX_VENDOR +#define TOYBOX_VERSION "0.8.11"TOYBOX_VENDOR #endif diff --git a/www/header.html b/www/header.html index e72481f4..ec0d2969 100644 --- a/www/header.html +++ b/www/header.html @@ -55,5 +55,5 @@ -

Current release 0.8.10 (July 30, 2023)

+

Current release 0.8.11 (April 8, 2024)


diff --git a/www/news.html b/www/news.html index f983d6f3..8054c635 100644 --- a/www/news.html +++ b/www/news.html @@ -37,6 +37,304 @@ bootable under QEMU (built using a Build: --> +

April 8, 2024

+
+

Another thing that got forgotten was the fact that against all probability a +sperm whale had suddenly been called into existence several miles above the +surface of an alien planet. And since this is not a naturally tenable position +for a whale, this poor innocent creature had very little time to come to terms +with its identity as a whale before it then had to come to terms with not being +a whale any more.

+

- The Hitchhiker's Guide to the Galaxy

+
+ +

Toybox 0.8.11 +(git commit) +is out, with prebuilt static binaries and +mkroot images +bootable under QEMU (built using a lightly patched linux-6.8).

+ +

Highlights include a new quickstart +web page, shorter /bin links to prebuilt binaries, +lots of work on mkroot, and a new "canned" toybox build to reduce +dependencies.

+ +

New commands: +Rob added tsort, and promoted fold and getopt. +Oliver Webb added ts and csplit, and +Elliott added memeater.

+ +

And one command got temporarily de-promoted: passwd is "default n" +(disabled in defconfig) this release due to the ongoing lib/passwd.c +infrastructure rewrite that isn't quite done yet. (See the Library section.)

+ +Features: +The new "canned" +toybox build in scripts/prereq/build.sh lets toybox provide its own +build prerequisites by compiling a minimal toybox against saved headers (ala +"cc -I scripts/prereq/generated file1.c file2.c..."). This provides +most of the commands toybox needs to configure and build itself (except make, +bash, and the compiler toolchain). This may help bootstrap toybox on systems +that don't provide a modern Linux command line out of the box: install +toybox-prereq at the start of the $PATH, add +a .config file, and run scripts/make.sh.

+ +

New mv -x option to atomically swap two files, +env -e FILE executes a different command than argv[0] on the command +line, the reset command now puts raw terminals back into "cooked" mode, +negative offsets in sort -k count right to left, +setsid grabs the tty more forcefully (removing the need for getty) +and the -cc option will try to steal it, +mount now shows file= when displaying loopback mounts, +wc -L shows longest line length, +tar -h now detects a lot more hardlinks, +cp now copies xattrs for directories (not just files).

+ +

Elliott taught file to recognize wasm binary modules and +display JPEG width/height, added the LOWER_UP, DORMANT, and ECHO +flags to ifconfig, added PAC and BTI decoding to readelf, +cache size querying to sysconf (supported by glibc and bionic but +not musl-libc), and added a "paste" menu to microcom. Kalesh Singh +taught readelf to decode a new note type (NT_ANDROID_TYPE_PAD_SEGMENT). +Christopher Ferris improved readelf section flags handling, +with test. Oliver Webb suggested count -l. +Aditya submitted netcat -z.

+ +Bugfixes: +Fixed printf \0 and grep -w (which never quite worked right), +ls -k now switches off --block-size, +install -dm 02750 works (sticky bit support for -d), +tar is better at following symlinks and extracting records with broken +metadata, gzip now knows +knows how to rename between "tgz/tar" extensions, +mkpasswd -m sha* salt length can now range from 8-16, not just 16, +ps can now handle an session ID of 0 (which is what PID 1 starts with +before the first call to setsid()), +pwgen can now use ~ in output, +xargs now stops when a child exits with 255, +iconv now exits with error if any characters failed to convert with -c, +things like truncate -s 1e2 were saying "too large" and now correctly +say "not integer" (it's not scientific notation, it's exabyte suffix with +trailing garbage), +timeout now takes its exit code from SIGCHLD instead of wait() +to fix a race condition (SIGCHLD can happen before calling wait and the +kernel won't deliver status twice, so you can't wait AND have the +signal handler). The usual round of gcc warnings got tracked down, confirmed +to be useless, and removed, but despite gcc constantly warning "variable is +not actually used uninitialized" there were some uninitialized variables in +dd it DIDN'T warn about: found and fixed.

+ +

Elliott added an error message to catch xxd -r receiving -p format +input without -p, +fixed readelf -n for x86-64 ibt/shstk notes +(whatever those +are), +and fixed blkid not to check filesystem signatures that would continue +past the end of the loaded buffer. +Michael Shavit pointed out that devmem command line number parsing +wasn't unsigned (although fixing that means it no longer parses the kmg unit +suffixes). +Peter Collingbourne fixed inotifyd skipping the first mask character. +Taisuke Matsushiro fixed a fencepost error preventing stty from +setting serial baud rate to 57600. +Askar Safin fixed a typo in mkroot/packages/busybox.

+ +Library: +The in-progress rewrite of lib/password.c no longer uses shadow.h +(which lets it build against bionic), +and a new lib/hash.c where toybox implements its own crypt() using +the md5/sha1/sha3 etc hash functions we've already got (to work around glibc's +ongoing deprecation of posix features), but neither are quite finished yet. +New lib/elf.c with plumbing shared by file and readelf, with +additional arm and riscv flag decoding, +the peek() family of functions now return long long instead of +int64_t so the base types are consistent on 32/64 bit, +lib/args.c now handles the high bit octal escape sequences in trailing +[-abc] blocks, so you can have punctuation participate in option groups, +switching off an option via grouping now sets it back to its default +value (not to zero), and numeric and date parsing report out of range numeric +or millisecond values.

+ +Mkroot: +There's a README in the mkroot directory now. (Microsoft Github was +picking up the README.root file used by the tar-for-web.sh script +and showing that instead.) +Extended run-qemu.sh so it can be run from other directories +(prepending $(dirname $0)/ to linux-kernel and initramfs.cpio.gz when +loading them into qemu). +The initramfs now has /etc/os-release with the toybox $VERSION. +The big if/else staircase of linux kernel target configurations +moved into its own get_target_config() shell function, with +a big comment block right before it explaining what all the variables +it sets mean, and the generic kconfig symbol list got moved out to +a GENERIC_KCONF variable assignment right after that function. +The microconfig format got compressed slightly more +by use of bash brace expansion, decoded to comma separated values by +the be2csv function ala KCONF="$(be2csv SPI{,_BITBANG} IOMMU_SUPPORT)" . +The init script no longer calls oneit, instead doing the work in the +init script. (Redirect stdin/out/err to the "real" console device on +the last line of /sys/class/tty/console/active, call setsid, trap SIGCHLD, +reboot when the shell exits. This (and the setsid tty stealing upgrades) also +fixed ps not showing any processes in mkroot because stdin/stdout weren't +properly claimed as the controlling tty. +The base kernel config now uses CONFIG_PANIC_TIMEOUT=1 so +we don't have to say panic=1 on the kernel command line anymore. +The baseconfig now automatically adds CONFIG_MODULES and +CONFIG_MODULES_UNLOAD when any $MODULES are listed. +Moved the kernel modules archive into the "docs" directory. +New $NOTOYBOX variable skips the toybox build if set. +The $DTB files no longer have a path, instead using "find" +to install them. +The build now creates the externally loadable cpio.gz file even when +building initramfs into the kernel, but sticks it in the docs/ subdirectory +when it's not used.

+ +

Several new mcm-buildall.sh targets (or1k, riscv32, riscv64, sh4eb) +taking advantage of upstream musl-cross-make updating itself to use +musl-1.2.5. The target list in mcm-buildall.sh moved into a TARGETS=() +array with a big comment before it explaining the format, and the script +is better about building host toolchains +to build other cross compilers with: it tries to autodetect the host +type (moving the relevant one to the front of the build list), and +will also build a missing host toolchain when given targets on the +command line. Added microblaze and or1k kernel configs, neither of which +know how to exit qemu yet. (If Linux has got a reboot mechanism it knows +how to poke that qemu is listening for on either virtual board, I haven't +found it yet.) Also added sh4eb with FDPIC support (see kernel patch, which +allows qemu-system-sh4eb to run the sh2eb nommu root filesystem), and armv4l +(the 486 of arm).

+ +Pending: +Elliott fixed and improved strace, translating more system calls. +Rob enabled command recursion in toysh (so it can call non-builtins as +builtins), fixed calling "exec" on NOFORK commands (which MUST run +in the shell's process context), redid the code to handle trailing +backslashes gluing lines together, and it no longer leaks script +filehandles into child processes. +Oliver Webb noticed that OLDTOY(MAYFORK) aliases didn't become shell +builtins, added tr -t, in vi added line gotos in ex mode, +'g', 'v', 'j' commands, and backwards search, cleaned up stuff in +xzcat, getopt, bc, and removed a bunch of useless autogenerated +bc tests. Jarno Mäkipää added the list of supported commands to vi's +help text. +Mathieu Anquetin fixed ip link set parsing, and NUL byte handling +in hexdump. +General cleanup passes on expr (which now uses 64 bit comparisons), +tr, and dhcpd.

+ +Cleanup: +pass over lsattr, getconf, acpi, and blkid. +Use FLAG() macros in ifconfig and restorecon. Removed TODO block +from nbd-client. +More error_msg("%s", str) converted to error_msg_raw(str). +Trimmed the GLOBALS() sizes (using scripts/probes/GLOBALS): +removed 1k of global data from cksum and switched a 2k global +in grep to a malloc. Simplified scripts/probes/bloatcheck and +mkroot/record-commands.

+ +Portability: +Fixed truncate -s 8g on 32 bit hosts, +updated mcm-buildall.sh to autodetect host type and automatically +select newer package versions, +and moved the linux32 command to its own file because BSD can't +build it. +MacOS had a use-after-free with the getpwuid() return value being recycled +a more aggressively than Linux. +Elliott fixed diff.test to work with mksh, and posix_fallocate() +to work with MacOS. +More commands enabled in make bsd_defconfig and make +macos_defconfig. +Added some (void) typecasts to netstat, oneit, and watchdog to try to +shut up compilers that insist on responding to uncorrectable failures. +(Such as fgets() reading known /proc data from the kernel, writes to +the watchdog timer that will reboot the system if they fail, or PID 1 calling +dup() on stdin to create stdout and stderr after closing the old ones. +If any of that goes wrong, what are we supposed to do about it?)

+ +Documentation: +The website now has a quickstart page, +and the site now defaults to the about page (updated index.html symlink). +The "current release" is now in the common header displayed by most pages. +The mkroot dir has a +README, and its faq entry +has been updated. +New option to compress help text with gzip, and help text size now shows +up in make bloatcheck. +Fix sed --help to show full help, patch -F is now mentioned +in the help text, tweaks to help text in cut, grep, +blkdiscard. +Elliott did a cleanup pass over "usage:" lines and alphabetized more help text +options. +Christian Koestlin fixed a typo in the dmesg docs. +The release +procedure checklist has been updated, and the README generated +by mkroot/tar-for-web.sh got updated. +New faq entry explaining why toybox doesn't have (or need) cttyhack, +and the architecture list got updated to match mcm-buildall.sh. +The usual roadmap updates.

+ +

New scripts/probes/cmd2dpkg script shows what +debian package (if any) each toybox command lives in, but only checks +installed packages (dpkg-query -S "$(which $COMMAND)") and debian breaks +up source packages strangely, so did not used it to redo the roadmap section +listing packages (created using Linux From Scratch's list of commands +installed by each source package).

+ +Plumbing: +The yes command now uses writev() to go way faster, mostly to +prove it can. +The default stdout buffer type switched to block buffering to make +Elliott happy, which is a rich source of bugs (many of which Elliott +has already whack-a-moled) and means among other things +that mixing write() and fwrite() calls now requires manual flushing. +Meanwhile xflush() became xferror() because it usually +wasn't flushing anyway, and now that's more noticeable. +Removed TOYFLAG_LOCALE and just set utf8 locale for all commands. +The dirtree code now sets DIRTREE_SYMFOLLOW in "again" when we followed +a symlink to get to this node, callers checking DIRTREE_COMEAGAIN need +to mask out the bit they're interested in. +Improved scripts/probes/findglobals output to be more legible.

+ +Test suite: +Added make test_help test_install targets. (The standalone +command targets conflict with the help/install make targets, but you +can still build them via scripts/single.sh and there's no reason not +to be able to individually test them.) +New utf8locale shell function attempts to enable a UTF8 locale for +TEST_HOST, which was used to fix wc.test. +Colin Cross fixed pidof.test when stdout is a socket. +Something called "ecryptfs" has a maximum filename length of 143 bytes, +so our tar.test for long filenames support needs to be skipped there +because the filesystem can't handle it. Similarly, our truncate.test +was failing because storing nothing on ecryptfs wasts more space than expected. +The tar tests now fetch user/group names with "stat" because +between Linux, Android, FreeBSD, and MacOS, there aren't really consistent +user and group names for any existing files. Added nbd-client.test +Thiébaud Weksteen fixed the getfattr/setfattr tests on +filesystems using selinux. Oliver Webb added sha3sum tests. +Elliott stabilized another slightly racy ifconfig test (big test +farm, hits the weird corner cases).

+ +Build: +Lots of changes to scripts/make.sh and friends to speed up and parallelize +header generation. The build now figures out which toys/*/*.c files +to compile by searching for unindented USE() macros wrapping NEW(commandname), +which among other things fixes enabling the builtins when selecting just +CONFIG_SH in menuconfig (instead of doing a "make sh" single command build). +It also probes for optional shared libraries in parallel. +New scripts/probes directory to collect scripts that aren't actually +used by the build, with a README in it. +Updated .gitignore so it doesn't complain about spurious name collisions in +subdirectories. Elliott shut up a +truly sad +warning where despite sizeof(ptrdiff_t) always being sizeof(long), gcc +nevertheless warns if you printf("%ld", ptr-ptr) and wants a magic invented +"%td" type on 32 bit systems (but is just fine on 64 bit). (Or we could add a +literally NOP typecast to long.) And silenced a spurious gcc 13.2 warning +in date.c. And Rob shut up more broken gcc warnings. +Updated .gitignore so it doesn't complain about spurious name collisions in +subdirectories.

+

July 30, 2023

The way it functioned was very interesting. When the Drink button was -- cgit v1.2.3 From f2079e0f446bb40f4cd568651c0c6c030b3aefb6 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 12 Apr 2024 11:58:37 -0500 Subject: A sufficiently loaded server may not be able to fork()/exec() in .1 seconds (Elliott saw this), so give it a full second. --- tests/timeout.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/timeout.test b/tests/timeout.test index 694540ae..624f3650 100755 --- a/tests/timeout.test +++ b/tests/timeout.test @@ -8,13 +8,13 @@ testcmd "times out" '.1 sleep 100 ; echo $?' '124\n' '' '' testcmd "failure" '-s MONKEY .1 sleep 100 2>/dev/null ; echo $?' '125\n' '' '' testcmd "early failure" '2>/dev/null ; echo $?' '125\n' '' '' -testcmd "can't execute" '.1 / 2>/dev/null ; echo $?' '126\n' '' '' -testcmd "can't find" '.1 /does/not/exist 2>/dev/null ; echo $?' '127\n' '' '' +testcmd "can't execute" '1 / 2>/dev/null ; echo $?' '126\n' '' '' +testcmd "can't find" '1 /does/not/exist 2>/dev/null ; echo $?' '127\n' '' '' testcmd "custom signal" '-s 3 .1 sleep 100; echo $?' '124\n' '' '' testcmd "killed" '-s 9 .1 sleep 100; echo $?' '137\n' '' '' testcmd "TERM" '-s TERM .1 sleep 100; echo $?' '124\n' '' '' -testcmd "exit 0" '.1 true ; echo $?' '0\n' '' '' -testcmd "exit 1" '.1 false ; echo $?' '1\n' '' '' +testcmd "exit 0" '1 true ; echo $?' '0\n' '' '' +testcmd "exit 1" '1 false ; echo $?' '1\n' '' '' testcmd "--preserve-status" '--preserve-status .1 sleep 100 ; echo $?' '143\n' '' '' testcmd "--preserve-status killed" '--preserve-status -s 9 .1 sleep 100 ; echo $?' '137\n' '' '' -- cgit v1.2.3 From 82720e5954cb20cfd52649a6c9e6bc47764a22a1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 13 Apr 2024 07:07:49 -0500 Subject: Add uname to freebsd_miniconfig (pointed out by Vidar Karlsen) --- kconfig/freebsd_miniconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kconfig/freebsd_miniconfig b/kconfig/freebsd_miniconfig index e82e3f95..0ca16d89 100644 --- a/kconfig/freebsd_miniconfig +++ b/kconfig/freebsd_miniconfig @@ -61,6 +61,7 @@ CONFIG_TOUCH=y CONFIG_TRUE=y CONFIG_TSORT=y CONFIG_TTY=y +CONFIG_UNAME=y CONFIG_UNIQ=y CONFIG_UNLINK=y CONFIG_UUDECODE=y -- cgit v1.2.3 From 7d9ee89d3cf80f5e712badd7caa988ce235ccda1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 16 Apr 2024 06:36:30 -0500 Subject: Vidar Karlsen says freebsd needs a magic constant. --- lib/portability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portability.c b/lib/portability.c index 83382d1d..abcecc80 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -65,7 +65,7 @@ struct mtab_list *xgetmountlist(char *path) int i, count; if (path) error_exit("xgetmountlist"); - if ((count = getmntinfo(&entries, 0)) == 0) perror_exit("getmntinfo"); + if (!(count = getmntinfo(&entries, MNT_WAIT))) perror_exit("getmntinfo"); // The "test" part of the loop is done before the first time through and // again after each "increment", so putting the actual load there avoids -- cgit v1.2.3 From 880e973acebe4a14e2a60a2a3a73aa869e899a58 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 18 Apr 2024 20:09:05 -0500 Subject: Let record-commands be run from an arbitrary directory. --- mkroot/record-commands | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mkroot/record-commands b/mkroot/record-commands index 32557a3e..e2bbb83c 100755 --- a/mkroot/record-commands +++ b/mkroot/record-commands @@ -14,9 +14,12 @@ fi if [ ! -x "$WRAPDIR/logpath" ] then + LOG="$(which logpath)" mkdir -p "$WRAPDIR" || exit 1 - [ -e "$(which logpath)" ] && cp -H "$(which logpath)" "$WRAPDIR/logpath" || - PREFIX="$WRAPDIR/" scripts/single.sh logpath || exit 1 + [ -e "$(which logpath)" ] || { cd "$(dirname $0)/.." && + PREFIX="$WRAPDIR/" scripts/single.sh logpath && LOG=$(readlink -f logpath)|| + exit 1; } + cp -H "$LOG" "$WRAPDIR/logpath" || exit 1 tr : '\n' <<< "$PATH" | while read i; do find "$i" -type f,l -maxdepth 1 -executable -exec basename {} \; | \ while read FILE; do ln -s logpath "$WRAPDIR/$FILE" 2>/dev/null; done -- cgit v1.2.3 From 544a855c85656f439a9809d503942c89be604a77 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 18 Apr 2024 20:20:00 -0500 Subject: Add cfspeed2bps() and bsp2cfspeed() conversion functions, and make xsetspeed() use them. --- lib/lib.h | 2 ++ lib/tty.c | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib/lib.h b/lib/lib.h index da20dd10..4618a2f0 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -333,6 +333,8 @@ int terminal_probesize(unsigned *xx, unsigned *yy); #define KEY_ALT (1<<18) int scan_key(char *scratch, int timeout_ms); int scan_key_getsize(char *scratch, int timeout_ms, unsigned *xx, unsigned *yy); +unsigned cfspeed2bps(unsigned speed); +unsigned bps2cfspeed(unsigned baud); void xsetspeed(struct termios *tio, int speed); int set_terminal(int fd, int raw, int speed, struct termios *old); void xset_terminal(int fd, int raw, int speed, struct termios *old); diff --git a/lib/tty.c b/lib/tty.c index 543006fb..7c249fcc 100644 --- a/lib/tty.c +++ b/lib/tty.c @@ -16,6 +16,7 @@ #include "toys.h" +// Check stdout, stderr, stdin (in that order) and if none open /dev/tty int tty_fd(void) { int i, j; @@ -72,19 +73,38 @@ int terminal_probesize(unsigned *xx, unsigned *yy) return 0; } -void xsetspeed(struct termios *tio, int speed) +// This table skips both B0 and BOTHER +static const int speeds[] = {50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, + 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, + 921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000,3500000,4000000}; + +// Show bits per second for cfspeed value. Assumes we have a valid speed +unsigned cfspeed2bps(unsigned speed) { - int i, speeds[] = {50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, - 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, - 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, - 2500000, 3000000, 3500000, 4000000}; - - // Find speed in table, adjust to constant - for (i = 0; i < ARRAY_LEN(speeds); i++) if (speeds[i] == speed) break; - if (i == ARRAY_LEN(speeds)) error_exit("unknown speed: %d", speed); - cfsetspeed(tio, i+1+4081*(i>15)); + if (!(speed&15)) return 0; + if (speed>15) speed = (speed&15)+15; + + return speeds[--speed]; } +// Convert bits per second to cfspeed value. Returns 0 for unknown bps +unsigned bps2cfspeed(unsigned baud) +{ + int i = 0; + + while (i15)*(4096-16+1); + + return 0; +} + +void xsetspeed(struct termios *tio, int bps) +{ + int i = bps2cfspeed(bps); + + if (!i) error_exit("unknown speed: %d", bps); + cfsetspeed(tio, i); +} // Reset terminal to known state, saving copy of old state if old != NULL. int set_terminal(int fd, int raw, int speed, struct termios *old) -- cgit v1.2.3 From f5dead2d15f596ec09df7f10a2a16e699778c726 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 19 Apr 2024 16:17:29 +0000 Subject: Add a getopt symlink. getopt was promoted out of "pending" recently. Change-Id: I89deb9abe0fa8f0a3561be289fc0bb5e65d25201 --- Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/Android.bp b/Android.bp index f4791fbc..5d9ec2eb 100644 --- a/Android.bp +++ b/Android.bp @@ -294,6 +294,7 @@ toybox_symlinks = [ "getconf", "getenforce", "getfattr", + "getopt", "gpiodetect", "gpiofind", "gpioget", -- cgit v1.2.3 From 475d3aa8577cd4ac8aee1bbcf6a57f0b0bd34943 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 19 Apr 2024 11:56:04 -0500 Subject: The -f doesn't reliably shut up chmod. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 100fd30e..09fed076 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ root_clean: @echo root cleaned clean:: - @chmod -fR 700 generated || true + @chmod -fR 700 generated 2>/dev/null || true @rm -rf toybox generated change install .singleconfig* @echo cleaned -- cgit v1.2.3 From 7c6aecd477a9b898df981197088c9e1d5775fe9c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 20 Apr 2024 09:58:06 -0500 Subject: Two changes to record-commands: 1) busybox find doesn't understand commas in -type so use parentheses and -o, 2) change semantics (sourcing changes variables) so running with no arguments sets up a persistent wrapper and outputs an export line to update variables. --- mkroot/mkroot.sh | 2 +- mkroot/record-commands | 23 ++++++++--------------- scripts/prereq/generated/config.h | 2 ++ 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/mkroot/mkroot.sh b/mkroot/mkroot.sh index cb6a78f9..227dbb3c 100755 --- a/mkroot/mkroot.sh +++ b/mkroot/mkroot.sh @@ -82,7 +82,7 @@ if [ -z "$NOLOGPATH" ]; then CROSS_COMPILE=${CROSS_COMPILE##*/} export WRAPDIR="$BUILD/record-commands" LOGPATH="$LOG"-commands.txt rm -rf "$WRAPDIR" "$LOGPATH" generated/obj && - WRAPDIR="$WRAPDIR" CROSS_COMPILE= NOSTRIP=1 source mkroot/record-commands || + eval "$(WRAPDIR="$WRAPDIR" CROSS_COMPILE= NOSTRIP=1 mkroot/record-commands)"|| exit 1 fi diff --git a/mkroot/record-commands b/mkroot/record-commands index e2bbb83c..71f2c4ef 100755 --- a/mkroot/record-commands +++ b/mkroot/record-commands @@ -5,23 +5,15 @@ [ -z "$WRAPDIR" ] && WRAPDIR="$PWD"/record-commands && RM=$(which rm) [ -z "$LOGPATH" ] && export LOGPATH="$PWD"/log.txt -if [ ${#BASH_SOURCE[@]} -lt 2 ] && [ $# -eq 0 ] -then - echo "usage: WRAPDIR=dir LOGPATH=log.txt record-commands COMMAND..." - echo 'Then examine log.txt. "record-commands echo" to just setup $WRAPDIR' - exit 1 -fi - if [ ! -x "$WRAPDIR/logpath" ] then LOG="$(which logpath)" mkdir -p "$WRAPDIR" || exit 1 - [ -e "$(which logpath)" ] || { cd "$(dirname $0)/.." && - PREFIX="$WRAPDIR/" scripts/single.sh logpath && LOG=$(readlink -f logpath)|| - exit 1; } - cp -H "$LOG" "$WRAPDIR/logpath" || exit 1 + [ -e "$LOG" ] && cp -H "$LOG" "$WRAPDIR/logpath" || { cd "$(dirname $0)/.." && + PREFIX="$WRAPDIR/" scripts/single.sh logpath >/dev/null && + LOG="$PWD/logpath" || exit 1; } tr : '\n' <<< "$PATH" | while read i; do - find "$i" -type f,l -maxdepth 1 -executable -exec basename {} \; | \ + find "$i" \( -type f -o -type l \) -maxdepth 1 -executable -exec basename {} \; | \ while read FILE; do ln -s logpath "$WRAPDIR/$FILE" 2>/dev/null; done done fi @@ -30,13 +22,14 @@ fi rm -f "$LOGPATH" # When sourced, set up wrapper for current context. -export PATH="$WRAPDIR:$PATH" -if [ ${#BASH_SOURCE[@]} -lt 2 ] +if [ $# -gt 0 ] then - "$@" + PATH="$WRAPDIR:$PATH" "$@" X=$? [ -n "$RM" ] && "$RM" -rf "$WRAPDIR" exit $X +else + echo export LOGPATH=${LOGPATH@Q} PATH=${WRAPDIR@Q}:${PATH@Q} fi diff --git a/scripts/prereq/generated/config.h b/scripts/prereq/generated/config.h index f46eed9b..60c87b5b 100644 --- a/scripts/prereq/generated/config.h +++ b/scripts/prereq/generated/config.h @@ -700,5 +700,7 @@ #define USE_TOYBOX_NORECURSE(...) #define CFG_TOYBOX_DEBUG 0 #define USE_TOYBOX_DEBUG(...) +#define CFG_TOYBOX_UID_SYS 100 +#define CFG_TOYBOX_UID_USR 500 #define CFG_TOYBOX_FORCE_NOMMU 0 #define USE_TOYBOX_FORCE_NOMMU(...) -- cgit v1.2.3