Earlier quoted context omitted.
> I cant run cosmolibc on Android, for example. You can: https://justine.lol/cosmo3/ > After nearly one year of development, I'm pleased to announce our version 3.0 release of the Cosmopolitan library. [...] we invented a new linker that lets you build fat binaries which can run on these platforms: AMD ... ARM64 https://github.com/jart/cosmopolitan/releases/tag/3.5.3 > This release fixes Android support. You can now…
Can you run it on RISCV Android?!
Pnut: A C to POSIX shell compiler you can trust
71–80 of 124 posts
Re: Pnut: A C to POSIX shell compiler you can trust
#72Instantly make your C code 200 times slower without any effort!
Re: Pnut: A C to POSIX shell compiler you can trust
#73This is very cool, regardless of how serious it was intended to be taken. Before base-64 encoders/decoders became more common as preinstalled commands in the environments I found myself on, I wrote a base64 utility in mostly pure POSIX shell: https://25thandClement.com/~william/2023/base64.sh If this project had existed I might have opted to compile my C-based base-64 encoder and decoder routines, suitably tweaked fo…
Re: Pnut: A C to POSIX shell compiler you can trust
#74Earlier quoted context omitted.
Implementation issues aside, while technically it should be possible to seek a file descriptor from shell through a suitable helper program in C, I believe none of the POSIX utilities provide this facility
head , read , and sed can be used for seeking forward according to POSIX (see the INPUT FILES section here https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V... >). I doubt non-GNU implementations support it though.
Re: Pnut: A C to POSIX shell compiler you can trust
#75Re: Pnut: A C to POSIX shell compiler you can trust
#76Hrmmm. But why? Quite frankly I think Bash scripting is awful and frequently wish shell scripts were written in a real and debuggable language. For anything non-trivial that is. I feel like I’d rather write C and compile it with Cosmopolitan C to give me a cross-platform binary than this. Neat project. Definitely clever. But it’s headed in the opposite direction from what I’d prefer...
I'm not the OP, but I think the goal is to make it cross architecture. Cross platform C compiler would give you cross OS compatibility, but chip architecture would still be fixed, I think. I.e., you can take your compiled.sh and run in an obscure processor with an obscure OS, as long as it's POSIX, it should work...
I suppose the trust moves to the shell executable then, but at least you could run the bootstrapping with multiple shells and expect identical output.
Re: Pnut: A C to POSIX shell compiler you can trust
#77When I'm told that "I can trust" something that I feel like I had no reason to distrust, it makes me feel even more suspicious of it
Re: Pnut: A C to POSIX shell compiler you can trust
#78Instantly make your C code 200 times slower without any effort!
It would actually be interesting to see how much faster dash is than everything else.
ksh93: 31s
dash: 1m06s
bash: 1m19s
zsh: >15m
[0]: https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/...EDIT: ksh93, not ksh
Re: Pnut: A C to POSIX shell compiler you can trust
#79It's a bad sign when I immediately look at the screenshot and see quoting bugs.
Author here, Because all shell variables in code generated by pnut are numbers, variables never contain whitespace or special characters and don't need to be quoted. We considered quoting all variable expansions as this is generally seen as best practice in shell programming, but thought it hurt readability and decided not to. If you think there are other issues, please let me know!
Super neat project, btw!
Re: Pnut: A C to POSIX shell compiler you can trust
#80I love things like these because they shake our perception of normal loose. And who said our perception of normal doesn't deserve a good shake? A C to shell compiler might seem impractical, but you know what is even more impractical? Having a separate language for a build system. And yet, here we are. Using Shell, Make or CMake to build a C program is only acceptable because is has always been so. It's a "perceived n…