Repository navigation
Description
Summary
#1905 replaced install.py's substring-based hook-ownership test with names_hook(command, name), matched against the same boundary characters runs_hook(command, path) already uses. Two local-strict-review passes on that fix (round 3) found names_hook still disagrees with runs_hook on a residual set of shapes, all narrower than the shapes #1905 itself needed to fix.
Gap 1: an unquoted path whose own directory holds a boundary character
runs_hook is handed the exact literal path and only checks the characters immediately before and after it, so a character such as an ampersand, semicolon, pipe, or parenthesis inside the path itself does not matter to it. names_hook has to discover the path's extent on its own, and its bare-word alternative excludes those same characters from the prefix it scans, so it cannot cross one embedded in an unquoted directory name.
Example command: python3 followed by an unquoted path whose directory segment contains an ampersand and a parenthesized suffix, then gh-write-guard.py. This gives runs_hook=True, names_hook=False. The same path quoted agrees (both True). Impact is judged small, since a real shell would not treat that unquoted string as one path anyway.
Gap 2: shell compositions runs_hook only accepts because it already knows the exact path
Examples that give runs_hook=True (matching a known exact path) but names_hook=False (the trailing name cannot be recovered by pattern alone):
- a double-quoted path nested inside an outer double-quoted
bash -cargument, with the inner quotes escaped - the path immediately followed by an output redirect with no separating space
- a path immediately followed by a backtick
Before #1905, the plain substring test (GUARD_STEM in command) claimed all of these, so a re-run of the installer stripped and re-registered them. After #1905, names_hook no longer claims them, so a re-run leaves such an entry in place untouched and appends the kit's own fresh entry alongside it, rather than replacing it. --report also stops flagging any problem with the old entry, where before it reported "names the guard but does not run the deployed one".
Why this is filed separately rather than fixed in #1905
Closing either gap fully means widening runs_hook itself (so the two functions keep agreeing), which is a design change beyond a local match tweak, and each attempted fix on this matching logic has surfaced a new, narrower edge case rather than converging. install.py's names_hook docstring notes this gap and points here.
Suggested scope for a fix
Decide whether these narrow, unusual command shapes are worth widening runs_hook's own boundary matching for, given that a hand-edited registration in any of these exact shapes appears to be rare in practice, and that the installer's own hook_command() always writes a plain, double-quoted, unadorned path with no such decoration.
Activity
Judge the Installer's Hook Ownership by File Name, Not Substring (#1954)
ptr727 commentedon Oct 23, 2026
Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.