amiga386
9 months ago
Here's the actual diff:
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/ksh/shf.c....
And it looks like that covers all parsed parts of the shell script or history file, including heredocs. I get the feeling it's going to break all shar archives with binary files (not that they're particularly common). It will stop NULs being in the script itself, but it won't stop them coming from other sources, e.g.
$ var=$(printf '\0hello')
-bash: warning: command substitution: ignored null byte in input
$ echo $var
hello
It remains to be seen if this will be adopted by anyone else, or if it'll be another reason to use OpenBSD only as a restricted environment and not as a general computing platform.> "If there is ONE THING the Unix world needs, it is for bash/ksh/sh to stop diverging further"
> OpenBSD ksh: diverges further
chasil
9 months ago
The only thing that is required to happen is that they all obey the rules of the POSIX shell (when called as /bin/sh).
Otherwise, anything goes.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...
All the userland utilities must have the behavior (and problems) specified here:
matrix2003
9 months ago
Eh - I actually like developing on OpenBSD first, because of restrictions like this. If it runs on OpenBSD, you are likely to have fewer bugs around things like malloc.
OpenBSD is also really good about upstreaming bug fixes, which is a good thing. Firefox used to be a dumpster fire of core dumps on OpenBSD, and many issues were uncovered and fixed that way.
jolmg
9 months ago
> I get the feeling it's going to break all shar archives with binary files
shar encodes binary files. Here's what it does with a file that has contents: "foo\0bar\n":
sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 foo.txt
(9F]O`&)A<@K.
`
end
SHAR_EOF
Interestingly, passing that heredoc to uudecode in the shell, it produces no output. However, if I pass the whole shar output to unshar, it does produce the file with the correct content.raverbashing
9 months ago
> I get the feeling it's going to break all shar archives with binary files (not that they're particularly common)
Base64 encode them.
This is not diverging further, this is bringing sanity to the table
bell-cot
9 months ago
> Here's the actual diff:
Only 8 short, simple lines of c code. Beautiful.