Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid XNU binaries generated by
apelink
in some edge cases (#…
…1106) * 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 d53c335 The `-s` option changed its meaning, but the docs weren't updated.
- Loading branch information