Commit 7e4fc07
authored
fix(macos): brace $code to stop unbound-variable crash in menu bar apply alert (#254)
fix(macos): brace $code to stop unbound-variable crash in menu bar apply failure alert (#251)
apply-from-menubar-macos.sh sources common-macos.sh's `set -euo
pipefail`, which leaves `-u` active even after the later `set +e`. The
failure-path alert referenced a bare $code immediately followed by a
full-width right parenthesis (`$code)`); under a UTF-8 locale, bash
misparses that as a different, never-assigned identifier and aborts
with "unbound variable" instead of showing the real failure — even
though `code=$?` had assigned it correctly a few lines earlier.
Reproduced against the real common-macos.sh under LANG=en_US.UTF-8:
bare `$code)` crashes, `${code})` does not. Braces disambiguate the
token boundary. Add a repo-wide static regression test (mirroring the
existing no-nested-:has() CSS guard) that fails on any bare $var
immediately followed by CJK punctuation in a shell script, so this
class of bug can't silently return.
This means every failure of `start-dream-skin-macos.sh
--restart-existing` from the menu bar — including, but not limited to,
the unrelated native-window verification issue — was showing this
bogus crash instead of the actual error message.1 parent b5a614e commit 7e4fc07
2 files changed
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
0 commit comments