firasuke / mussel

The shortest and fastest script to build working cross compilers targeting musl libc
ISC License
89 stars 12 forks source link

Fix ``trap: ERR: bad trap`` and ``mussel: 1: fail: not found`` on dash #35

Open takusuman opened 5 hours ago

takusuman commented 5 hours ago

Just perceived that this code won't work on dash just because trap on POSIX faithful implementations doesn't have access to variables nor functions declared on the code; in other words, it seems like it is evaluated at the time it is declared and not when it has to be called. I honestly question why the POSIX standard, even though it's basically a "bougiefied" Bourne shell with some proprietary UNIX vendors and KornShell 88 extensions, still being so suffering-worthy sometimes. Anyway, for now, a fix would be to call /bin/ksh93 --- haven't tested with ksh88/OpenBSD's pdksh, though --- or /bin/bash until I can refactor these and get some way out that doesn't make the code look like a pile of mere hacks. Pardon for the hassle, but I think this feature was more needed than compatibility, at least for now.

EDIT: Damn, same happens on OpenBSD's pdksh (or "oksh", as it is known nowadays), so probably it also happens on the original AT&T impl. of KornShell 88.

Originally posted by @takusuman in https://github.com/firasuke/mussel/issues/33#issuecomment-2364993073

firasuke commented 4 hours ago

EDIT: Damn, same happens on OpenBSD's pdksh (or "oksh", as it is known nowadays), so probably it also happens on the original AT&T impl. of KornShell 88.

I thought so as well, thanks for confirming that.