3 ms·
It's not really a shell script though, it just looks like one enough to the point that a bourne shell can modify it to be directly executable. I'd probably be
by chungy 6y ago
It's not really a shell script though, it just looks like one enough to the point that a bourne shell can modify it to be directly executable.
I'd probably be most worried about the bourne shell part. It seems like it'll be easy for this to break on any "non-standard" shell that Linux might execute.
- icedchai 6y agoThis is true, but the shell is executing it "as if" it were a script, right? Until the binary part takes over...
- jart 6y agoThe behavior that Cosmopolitan needs is required by POSIX because UNIX Sixth Edition didn't have shebang lines. It's normally an implementation detail of execve() in C libraries and the behavior is implemented by nearly all shells too. So far the only issue has been that some shells, like zsh, have a binary safety check where it refuses to run scripts that have embedded NUL characters. I worked with the FreeBSD team to get POSIX revised to clarify the correct behavior w.r.t. these restrictions. FreeBSD's /bin/sh has already been patched and zsh is pending upstream. https://github.com/jart/zsh/commit/94a4bc14bb2e415ec3d10cf716512bd3e0d99f48 https://github.com/jart/zsh/commit/94a4bc14bb2e415ec3d10cf71...
- ashkankiani 6y agoI appreciate the thoroughness with which you are pursuing this. The amount of work you're doing outside of the technical aspect is definitely something I can admit that I would've never pursued. It's encouraging to see.