[Toybox] [PATCH] toysh: Shut up TEST_HOST, correct 3 test cases

Oliver Webb aquahobbyist at proton.me
Sun Mar 17 08:23:24 PDT 2024


On Fri, Mar 8, 2024 at 19:46, Rob Landley <[rob at landley.net](mailto:On Fri, Mar 8, 2024 at 19:46, Rob Landley <<a href=)> wrote:

> On 3/7/24 19:39, Oliver Webb via Toybox wrote:
>> Looking at toysh again since the toybox test suite should run under it
>> (in mkroot or under a chroot) A problem seems to be that there is no
>> return command, which breaks runtest.sh to it's core. Dont know how to add one in yet
>>
>> On my version of bash (5.2.26) TEST_HOST fails on 3 test cases,
>> and toysh also fails on those cases (Even tho toysh is doing the right
>> thing, the same as bash) The attached patch changes the test file
>> so that 3 test cases are resolved. And TEST_HOST works
>
> Because Chet changed stuff I asked him about, making bash a moving target.

This does bring up the question of what to do with specific edge cases. Since bash can’t even be consistent with itself, most bash scripts don’t rely on them, at least the ones I’ve seen.

Should we set out to implement every specific edge case, and if so what version are we confirming with? Or should we pick what’s most sensible/easiest to deal with and toyonly the test cases for them.

In the end both result in 99.9% of bash scripts being able to run, and the remaining 0.1% that can’t not being able to run on even certain versions of bash. And they are both ”correct“, except one is significantly harder to maintain and decide which sub-approach is _truely_ “correct“.

<(keep in mind) that even though you are a shell maintainer
Who’s read through the bash man page and posix spec and whatnot,
Most people ${havent//} and only use a {small..set} of
bashisms, $(read -s <<< „of which“) their behavior is fairly [[ predictable ]] and $“constant“.

And thats when they DON‘T just write POSIX/dash compatible scripts.

> Breaks test_host on Devuan Bronchitis using bash 5.0.3. Lemme get back to this
> one from Minneapolis. (Please poke me if I forget next week, I am completely fried.)

*poke*

- Oliver Webb <aquahobbist at proton.me>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240317/2b972af7/attachment.htm>


More information about the Toybox mailing list