Repository navigation
Commit dad40cc
committed
fix(install): accept a Codex hook binary path that contains a space (DeusData#2044)
On a machine whose profile path contains a space (C:\Users\First Last),
every install failed Codex with
op=hook_preflight reason=command_render
before config.toml was even read. The hook commands are rendered by
cbm_shell_quote_word / cbm_powershell_quote_word, which always single-quote
the installed binary path and accept a space (they refuse only control
bytes). The Codex hook block then validates its own rendered commands with
toml_codex_executable_is_safe, which refused every byte below 0x21 even
inside the single quotes. The validator was one character stricter than
the writer, so cbm refused the command it had just rendered, and the whole
activation stopped.
Inside the single-quoted form a space is literal in sh and PowerShell alike,
so the quoted branch now accepts 0x20. An unquoted executable word must
still be free of spaces (the shell would split it), and control bytes, DEL
and the unquoted metacharacters stay refused. The same check reads existing
hook entries back as owned, so a block written for a spaced path is adopted
on the next install and removed cleanly on uninstall.
Reproduced end to end with HOME containing a space on macOS, on v0.10.8 and
on main: install exited 1 with the exact error from the report. With the
fix it exits 0, writes both hook commands with the quoted path, a second
install is idempotent, and uninstall restores config.toml byte for byte.
Test: config_toml_codex_accepts_quoted_binary_path_with_spaces renders the
exact strings the two quoters emit for a spaced path (POSIX and Windows
forms) through check-only, upsert, idempotent re-upsert, and remove, and
pins that an unquoted spaced word is still refused with command_render.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent 5958f54 commit dad40cc
2 files changed
Lines changed: 56 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2774 | 2774 | | |
2775 | 2775 | | |
2776 | 2776 | | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
2777 | 2782 | | |
2778 | 2783 | | |
2779 | | - | |
| 2784 | + | |
2780 | 2785 | | |
2781 | 2786 | | |
2782 | 2787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1394 | 1443 | | |
1395 | 1444 | | |
1396 | 1445 | | |
| |||
1506 | 1555 | | |
1507 | 1556 | | |
1508 | 1557 | | |
| 1558 | + | |
1509 | 1559 | | |
1510 | 1560 | | |
1511 | 1561 | | |
0 commit comments