fix(fish-deps): show real binary path + drop hardcoded /usr/bin in paru/yay wrappers #62

Merged
rootiest merged 2 commits from fish-deps-real-binary-resolution into main 2026-06-22 06:18:30 +00:00
Owner

Summary

Two related fixes around the paru/yay PTY-logging wrappers (which live in ~/.local/bin and shadow the real binaries on PATH):

  1. fish-deps showed the wrapper path. Status reported ~/.local/bin/paru (our shim) as the install location instead of the real binary.
  2. The wrappers hardcoded /usr/bin/{paru,yay} — both for the presence check and as the command they shell out to. On any host where paru/yay live elsewhere, the generated wrapper would call a nonexistent path.

Both now share one resolver.

Commits

  1. feat(fish-deps) — add functions/__fish_real_command.fish: walks every PATH match for a name and returns the first that is not one of our generated wrappers, identified by the # <name>-wrapper-version: marker (grep -qsIF; -I makes real ELF binaries count as no-match, so only our text shims are skipped). It never returns one of our own wrappers, so a caller embedding the result can't create a shim that recurses into itself. Wire it into the fish-deps status (Found at …) path.

  2. fix(paru/yay-wrapper) — resolve the real binary via __fish_real_command (skipping our shim) for both the presence check and the embedded cmd_str, instead of the /usr/bin literal. Bump wrapper version 5 → 6 so existing installs regenerate against the resolved path.

No docs changed: __fish_real_command is an internal __-helper (not catalogued in the SSOT, consistent with __fish_config_op_enabled), and the SSOT wrapper prose never asserted a /usr/bin path.

Manual Verification

  • fish-deps (status) shows paru and yay with their real paths (e.g. /usr/bin/paru), not ~/.local/bin/paru.
  • Open a fresh shell, then head -20 ~/.local/bin/paru — the wrapper regenerated at # paru-wrapper-version: 6 and its cmd_str="…" points at the real binary (not ~/.local/bin/paru). Same for yay.
  • paru -Qi <pkg> (or any paru/yay invocation) still runs correctly through the wrapper with progress preserved, and a fresh log lands in ~/.terminal_history.
  • __fish_real_command rg returns the real rg binary (function-shadowed command still resolves correctly).
  • __fish_real_command __nonexistent; echo $status → prints nothing, status 1.
  • With logging disabled (set -U __fish_config_op_logging 0, new shell), the ~/.local/bin/{paru,yay} shims are removed and fish-deps still shows the real paths; re-enable afterward.
## Summary Two related fixes around the paru/yay PTY-logging wrappers (which live in `~/.local/bin` and shadow the real binaries on PATH): 1. **fish-deps showed the wrapper path.** Status reported `~/.local/bin/paru` (our shim) as the install location instead of the real binary. 2. **The wrappers hardcoded `/usr/bin/{paru,yay}`** — both for the presence check and as the command they shell out to. On any host where paru/yay live elsewhere, the generated wrapper would call a nonexistent path. Both now share one resolver. ### Commits 1. **`feat(fish-deps)`** — add `functions/__fish_real_command.fish`: walks every PATH match for a name and returns the first that is **not** one of our generated wrappers, identified by the `# <name>-wrapper-version:` marker (`grep -qsIF`; `-I` makes real ELF binaries count as no-match, so only our text shims are skipped). It never returns one of our own wrappers, so a caller embedding the result can't create a shim that recurses into itself. Wire it into the fish-deps status `(Found at …)` path. 2. **`fix(paru/yay-wrapper)`** — resolve the real binary via `__fish_real_command` (skipping our shim) for both the presence check and the embedded `cmd_str`, instead of the `/usr/bin` literal. Bump wrapper version `5 → 6` so existing installs regenerate against the resolved path. No docs changed: `__fish_real_command` is an internal `__`-helper (not catalogued in the SSOT, consistent with `__fish_config_op_enabled`), and the SSOT wrapper prose never asserted a `/usr/bin` path. ## Manual Verification - [x] `fish-deps` (status) shows paru and yay with their **real** paths (e.g. `/usr/bin/paru`), not `~/.local/bin/paru`. - [x] Open a fresh shell, then `head -20 ~/.local/bin/paru` — the wrapper regenerated at `# paru-wrapper-version: 6` and its `cmd_str="…"` points at the real binary (not `~/.local/bin/paru`). Same for yay. - [x] `paru -Qi <pkg>` (or any paru/yay invocation) still runs correctly through the wrapper with progress preserved, and a fresh log lands in `~/.terminal_history`. - [x] `__fish_real_command rg` returns the real `rg` binary (function-shadowed command still resolves correctly). - [x] `__fish_real_command __nonexistent`; `echo $status` → prints nothing, status `1`. - [x] With logging disabled (`set -U __fish_config_op_logging 0`, new shell), the `~/.local/bin/{paru,yay}` shims are removed and `fish-deps` still shows the real paths; re-enable afterward.
rootiest added 2 commits 2026-06-22 06:17:13 +00:00
Add __fish_real_command, which walks all PATH matches for a name and
returns the first that is NOT one of this config's generated wrappers
(identified by the "# <name>-wrapper-version:" marker; grep -I treats
real ELF binaries as no-match so only our text shims are skipped). It
never returns one of our own wrappers, so a caller embedding the result
can't build a shim that recurses into itself.

Use it for the fish-deps status "(Found at ...)" path so paru/yay show
the real binary instead of the ~/.local/bin logging shim.
The generated PTY-logging wrappers hardcoded /usr/bin/{paru,yay} both for
the presence check and as the command the wrapper shells out to, breaking
on any host where the binary lives elsewhere. Resolve the real path via
__fish_real_command (which skips our own shim) and embed that. Bump the
wrapper version 5 -> 6 so existing installs regenerate.
rootiest merged commit bdf4581b28 into main 2026-06-22 06:18:30 +00:00
rootiest deleted branch fish-deps-real-binary-resolution 2026-06-22 06:18:30 +00:00
Sign in to join this conversation.