Commit ef4e6cd
committed
unbreak macOS Apple Silicon install, atomic Linux install, real version smoke test
Three independently-motivated bug fixes in scripts/install.sh:
1. macOS Apple Silicon: AMFI rejects the release Mach-O at exec
The lightpanda-aarch64-macos asset has a linker-signed ad-hoc
signature without a CMS blob (`codesign -dv` shows
flags=0x20002(adhoc,linker-signed)). AMFI on Apple Silicon
enforces stricter requirements outside trusted prefixes; from
/tmp or ~/.local/bin the kernel rejects it as
'Unrecoverable CT signature issue, bailing out' and SIGKILLs
at exec. Re-signing locally with `codesign -s -` adds a CMS
blob but AMFI then rejects with error -423 (adhoc signed by
unknown chain).
Verified empirically: same byte-identical Mach-O runs from
/opt/homebrew/Cellar/lightpanda/.../bin/lightpanda but is
SIGKILLed from /tmp/. Copying the broken curl-downloaded
bytes INTO the brew path makes them run. So the trust is
path-based, not byte-based.
The Lightpanda brew formula does NOT build from source
(verified via `brew cat`) — it just downloads the same
Mach-O and runs `bin.install` to place it at
/opt/homebrew/Cellar/.../bin/lightpanda, which AMFI exempts
from the strict ad-hoc signature check.
Reproducing on M3 Pro / macOS 14.x; should be uniform across
Apple Silicon but not directly tested on M1/M2/M4. Intel
macOS keeps the GitHub Release Mach-O path — Apple Silicon's
stricter AMFI enforcement is arm64-specific and I don't have
an Intel Mac to test.
2. Failed reruns destroy existing working binary
SKILL.md documents reruns as the update path, but
curl -L -o "$INSTALL_DIR/$BINARY_NAME" overwrites the install
target during download. Atomic install via mktemp + verify +
smoke-test + mv preserves the existing binary on any failure.
3. --version smoke test silently accepts broken binaries
Lightpanda's CLI has no --version flag; running it logs
'$msg=exit err=UnknownCommand' and exits 1. The current
2>/dev/null + --help fallback masks this, and the head -1 pipe
at the end means it succeeds on broken binaries that produce
no output. Use the 'version' subcommand and capture stderr
to surface real diagnostics like 'GLIBC_2.32 not found' on
failure.
Smaller adjacent changes, each tightly motivated by the three above:
- set -euo pipefail (was set -e); curl -fSL (was -sL/-L). pipefail
+ -f propagate curl HTTP errors through curl | jq, replacing the
misleading 'could not retrieve checksum' message.
- chmod 0755 instead of chmod a+x. Required because fix #2 uses
mktemp (0600); chmod a+x on top yields 0711 (owner-only readable).
- Apple Silicon PATH-shadow warning. A user upgrading from a pre-
this-PR version still has the rejected ~/.local/bin/lightpanda
(the linker-signed Mach-O) which shadows the new working brew
binary in PATH — without the warning they still get SIGKILL after
a successful brew install.
- LIGHTPANDA_DIR warning on Apple Silicon (brew owns the install
path; the variable is silently ignored without this).
- SKILL.md Install section: per-OS callout describing the flow split.
Better long-term fix (out of scope for this PR): upstream-side, the
build pipeline producing the GitHub Release assets should apply a
proper ad-hoc signature with a CMS blob (or, better, Developer ID +
notarization). The release Mach-O would then run from anywhere and
this workaround wouldn't be needed.
Intentionally not included (offered as follow-ups):
- Optional $GITHUB_TOKEN for API quota
- PATH-shadow check on the shared download flow
- Upstream-side signing fix (separate repo)1 parent bc562f3 commit ef4e6cd
2 files changed
Lines changed: 102 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | | - | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
39 | 88 | | |
40 | 89 | | |
41 | 90 | | |
| |||
50 | 99 | | |
51 | 100 | | |
52 | 101 | | |
| 102 | + | |
| 103 | + | |
53 | 104 | | |
| 105 | + | |
54 | 106 | | |
55 | 107 | | |
56 | 108 | | |
| |||
75 | 127 | | |
76 | 128 | | |
77 | 129 | | |
78 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
79 | 134 | | |
80 | | - | |
| 135 | + | |
81 | 136 | | |
82 | 137 | | |
83 | 138 | | |
| |||
89 | 144 | | |
90 | 145 | | |
91 | 146 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
95 | 156 | | |
96 | 157 | | |
97 | 158 | | |
98 | 159 | | |
99 | | - | |
| 160 | + | |
100 | 161 | | |
101 | | - | |
| 162 | + | |
102 | 163 | | |
103 | 164 | | |
104 | 165 | | |
105 | 166 | | |
106 | 167 | | |
107 | 168 | | |
108 | | - | |
| 169 | + | |
109 | 170 | | |
110 | 171 | | |
111 | 172 | | |
112 | 173 | | |
113 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
114 | 198 | | |
115 | 199 | | |
116 | 200 | | |
| |||
120 | 204 | | |
121 | 205 | | |
122 | 206 | | |
123 | | - | |
124 | 207 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 208 | + | |
131 | 209 | | |
132 | 210 | | |
133 | 211 | | |
| |||
0 commit comments