by Ericson2314 · 1y ago · 0 comments
We have a decent amount of code in bash that I'd like to get working on Windows too, once Nix on Windows is ready. I'm happy to rewrite it to a better language, but if I can get a non-CygWin/MSYS2 bash-compatible shell, that's a very nice thing to try out.
https://frippery.org/busybox/index.html
This is actually the Almquist shell with many bashisms brought in (no arrays though).
C:\>\bin\busybox sh
C:/ $ uname -a
Windows_NT MyHostname 10.0 22631 x86_64 MS/Windows
Edit: The ADA port below might interest you.I believe that busybox is produced by the Windows cross-compiler that I have loaded from EPEL. Can gsh be built the same way?
https://news.ycombinator.com/item?id=43910883 (similar comment about Rust)
Bash arrays are extremely hairy, with many corner cases, and differ from bash version to version.
And in particular, the shell code in Nix DOES RELY on these corners (e.g. https://www.oilshell.org/blog/2024/06/release-0.22.0.html)
---
I mentioned in another comment that Koichi Murase, who is a bash contributor, and wrote the largest shell program in the world, just overhauled the bash array support in OSH
A few relevant test files -- Koichi added a huge number recently:
https://oils.pub/release/0.29.0/test/spec.wwz/osh-py/array-s...
https://oils.pub/release/0.29.0/test/spec.wwz/osh-py/array-a...
https://oils.pub/release/0.29.0/test/spec.wwz/osh-py/ble-idi...
Our tests are thorough enough that we ROUTINELY find bugs in bash, like integer overflow bugs.
Koichi also knows about the differences between say bash 4.3, 4.4, 5.0, 5.1, etc. Because he wrote a very large program that uses bash arrays all over the place.
---
Feel free to use our tests in any case (other shells like the Scheme shell used to bootstrap Guix have)
And feel free to post a message to https://github.com/oils-for-unix/oils if you're interested or have questions
you'd probably want the rest of the programs, too. bash isn't too useful on its own. you can also find those on the same website