[Toybox] is orthodoxy a strong value of toybox?

Marc Chantreux mc at unistra.fr
Thu Sep 1 03:25:32 PDT 2022


hello people,

This is my first post so:

* Rob (and maybe other contributors I don't know about): thank you so much for your work
* short intro of myself: I work at the University of Strasbourg HPC,
  linux user since the last millenium (always happy to help and share),
  perl monger and raku early adopter.

I would like to challenge toybox as the standard shell scripting environment
for some projects at work as:
* we need something to be officially supported
* we fear GNU tools (both bash and coreutils)
* 9base and sbase are niche
* I saw a great talk about busybox vs toybox

So here I am. What I did for the moment is:

	make menuconfig
	make
	set $(realpath ./toybox) ~/local/bin
	mkdir -p $2/t
	$1 | tr ' ' '\n' | xargs -IT ln -s $1 $2/t/T
	<<. install -m700 /dev/stdin ~/local/bin/toys
	#! /bin/sh
	PATH=$2:\$(getconf PATH)
	exec $1 sh "\$@"

* thanks to zsh pathdirs, I can type t/sed to refer to toybox's sed.
* I have this `toys` shell to test complete scripts

Rob said toybox will be nothing more, nothing less but an implementation
of the POSIX standard (and I understand why) which defines a function
definition as

	fname () compound-command

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05

when a lot of shells (even dash) accept

	fname () command(compound or not)

	<<\. toys
	for shell in zsh dash mksh oksh 'busybox sh' yash toys; do
		$shell -c "f() echo $shell does; f"
	done

zsh does
dash does
mksh does
oksh does
busybox sh does
yash -c:1: syntax error: a function body must be a compound command
sh: toys: No such file or directory

If I want that feature, I need a first external dependency (i'll
probably choose rc or [om]ksh) but is orthodoxy a strong value of toybox?

In another words: if I provide a patch to accept this grammar:

	fname () command

Is there a chance for it to be merged ?

regards,
-- 
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200


More information about the Toybox mailing list