mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
99f0491f04
* Fix `if...fi` generation in the generated APE shell script
A shell will fail with a syntax error on an empty `if` or `else` body.
That is, neither of these is allowed:
# Empty `if`
if [ ... ]; then
fi
# Empty `else`
if [ ... ]; then
...
else
fi
There were two places where `apelink` could generate problematic `if`'s:
1. The XNU shell generation for aarch64 binaries when no loaders (either
binary or source) are provided. They can't assimilate, so the resulting
`else` body becomes empty.
There is actually a code path guarded by the `gotsome` variable that
inserts an extra `true` in this case, but the variable was never
initialized, so in practice this code path didn't activate in my
tests. This is fixed by initializing the variable.
2. The loader extraction code when no loaders are provided and XNU
support is requested. This is fixed by adding a simliar code path
that prevents an empty body from being generated.
* Update the apelink manual after commit
|
||
---|---|---|
.. | ||
dso | ||
lib | ||
apelink.c | ||
ar.c | ||
assimilate.c | ||
bigmul.c | ||
BUILD.mk | ||
chmod.c | ||
cocmd.c | ||
compile.c | ||
cp.c | ||
dd.c | ||
dlopen_test.c | ||
dropcache.c | ||
echo.c | ||
elf2pe.c | ||
elf2pe.h | ||
false.c | ||
fastdiff.c | ||
findape.c | ||
findelf.c | ||
findpe.c | ||
fixupobj.c | ||
freebsd2sysv.c | ||
gzip.c | ||
helpop.c | ||
killall.c | ||
lz4toasm.c | ||
march-native.c | ||
mkdeps.c | ||
mkdir.c | ||
mktemper.c | ||
mv.c | ||
nproc.c | ||
objbincopy.c | ||
package.c | ||
pecheck.c | ||
pledge.c | ||
printf.c | ||
pwd.c | ||
reboot.c | ||
rm.c | ||
rollup.c | ||
runit.c | ||
runit.h | ||
runitd.c | ||
sha256sum.c | ||
shutdown.c | ||
summy.c | ||
symtab.c | ||
touch.c | ||
unbuffer.c | ||
unveil.c | ||
verynice.c | ||
zipcopy.c | ||
zipobj.c |