News for hackers. Stuff that matters.
Re:OpenBSD now enforcing no invalid NUL characters in shell ... by comex on Tuesday September 24, 2024 @04:16PM (#41640451)
Looking at this further, the standards change doesn't even match what Cosmopolitan is doing.

From the 'changed their rules' link, the 'Desired Action' is to add this text: "The input file may be of any type, but the initial portion of the file intended to be parsed according to the shell grammar [..] shall not contain the NUL character."

This handles things like shar archives where you have a shell script at the beginning, then an exit command, then binary gunk.

But Cosmopolitan binaries are not just shell scripts with binary. They're hybrids of shell script and DOS executable. And apparently this requires putting nul bytes right near the beginning (see my other comment, https://news.ycombinator.com/item?id=41640331), in the "portion [..] intended to be parsed according to the shell grammar". Which explicitly violates the new text.

I can understand why this hack is needed for what Cosmopolitan is trying to accomplish, but it makes no sense to claim POSIX blessed it.

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by chubot on Tuesday September 24, 2024 @04:22PM (#41640506)
Yeah exactly, that was my reading too! The claim in the link doesn't match what the POSIX bug says

If it did, then would be a sign that the POSIX process is not working well

Because POSIX is supposed to be descriptive of what exists, not prescribe new behavior

Re:OpenBSD now enforcing no invalid NUL characters in shell ... by enriquto on Tuesday September 24, 2024 @04:30PM (#41640591)
> POSIX is supposed to be descriptive of what exists, not prescribe new behavior

Well, it can be argued that ape already existed when that POSIX change was written :)

Everything is working as intended. Nothing to see here. Move along. Move along.