i'm not sure it's 100% mksh's fault? the obvious quoting alternatives do work directly:
$ adb shell cheetah:/ # /system/bin/test abc =~ a.c test: too many arguments 2|cheetah:/ # /system/bin/test abc =\~ a.c cheetah:/ # /system/bin/test abc '=~' a.c cheetah:/ # ^D On Fri, Jan 10, 2025 at 5:48 PM Rob Landley <r...@landley.net> wrote: > > On 1/10/25 14:01, enh wrote: > > On Fri, Jan 10, 2025 at 12:17 PM Rob Landley <r...@landley.net> wrote: > >> > >> On 1/10/25 09:19, enh wrote: > >>> On Thu, Jan 9, 2025 at 5:41 PM Rob Landley <r...@landley.net> wrote: > >>>> $ ./test abc '=~' a.c > >>>> $ ./test abc =~ a.c > >>>> > >>>> Commit 2407a5f51b58 added support for "=~". Is your shell somehow > >>>> expanding ~ maybe? (I thought that only happened when it was the first > >>>> character of its word?) > >>> > >>> interesting you should say that because... > >> > >> Shenanigans in mksh was the main thing left to look at. And I went > >> fairly thoroughly through this area implementing it myself. > >> > >> https://landley.net/notes-2020.html#02-01-2020 > >> > >> I don't remember if these are in sh.test or my sh-todo.txt but it's > >> stuff I cared about getting right, none expand in bash: > >> > >> echo ""~ > >> echo ~"landley" > >> echo ~landle\y > >> > >> Aha! And I'm getting one wrong. Quote removal still needs to happen for > >> ~"landley" it just happens _after_ tilde expansion fails... > >> > >>>>> 2|cheetah:/ # /system/bin/toybox test abc =~ a.c > >>>>> test: too many arguments > >>>> > >>>> Try "echo abc =~ a.c" maybe? > >>>> > >>>>> 2|cheetah:/ # test abc =~ a.c > >>>>> /system/bin/sh: test: =/: unexpected operator/operand > >>>>> 2|cheetah:/ # > >>>> > >>>> Ok, not using the shell builtin. Huh. > >>> > >>> ...and look at the error: it says "test: =/: " implying that, yes, =~ > >>> has been turned into =/ by mksh. > >> > >> Commit c914983e3aee > > > > still broken in the same way. i've tried various kinds of extra > > escaping with no luck either... > > Er, some of them were already in single quotes not double quotes, so the > extra single quote dropped out. > > It's kind of hard for me to test under mksh here: > > $ mksh scripts/test.sh test > W: scripts/test.sh: scripts/portability.sh[47]: setlocale: No such file > or directory > test:generated/{Config.in > Warning: Config.probed changed, run 'make oldconfig' > ,newtoys.h,flags.h,help.h} > Compile generated/testdir/test > .................... > E: scripts/test.sh[27]: export: -n: unknown option > > Tell you what, I can just comment these tests out until I get toysh > running the test suite. It's actually not that far off now I've gotten > unblocked again... > > Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net