Skip to content

self install records every page in share/man/man1, so self uninstall removes other apps' pages #780

Open

Description

@David-Noble-at-work

installManPagesTo in cmd/internal/cli/selfinstall.go generates the app's own man pages with
doc.GenManTree, then lists every file in <prefix>/share/man/man1 and returns the lot as "installed".
installManPagesUnderPrefix records each with its SHA-256 in the app's manifest. self uninstall removes
every manifest entry whose hash still matches. Another app's page, unchanged since, matches.

In one line: each app's manifest claims every man page in the shared directory, so uninstalling one app
deletes the others' pages.

Per-app state, 2026-09-02, prefix ~/.local

App Installed Manifest Its pages in man1
devlore-test no none 0
lore yes none 24
star yes claims 117, 55 its own 55
writ yes claims 115, 28 its own 28

The other 10 pages in man1 belong to the Personal repository's scripts.

  • devlore-test has never been installed here. It registers the same self command and inherits the
    defect the day it is.
  • lore has a binary but no manifest, so it was put there by something other than a current
    self install. With no manifest its uninstall deletes nothing. Lore is a victim: its 24 pages are claimed
    by both star's and writ's manifests.
  • star and writ are the two that would delete. Either one's uninstall takes lore's 24 pages and the 10
    script pages along with its own. man1 holds 117 files; star's manifest claims all 117.

Config is not affected: uninstall removes only config.d/<tool>.yaml and never the shared config.yaml.

Requirements

All four programs — devlore-test, lore, star, writ — get exactly the same self subcommands, with the
same behavior. Uniformity on this dimension is the requirement, not a preference.

  1. Each generates its own default config, man pages and completions — completions for every installed
    shell: bash, fish, or zsh (PowerShell where present).
  2. Each writes a manifest of the files it installed, and only those.
  3. The manifest decides removal: self uninstall removes a file only if it is in the manifest and
    unchanged since install. A changed file is left behind and reported.

Evidence of completion

  • installManPagesTo returns only the pages it generated for rootCmd
  • the completion and extension steps audited against the same rule: only what this app wrote
  • the four programs register the same self subcommands, asserted by one test over all four roots
  • self install produces the default config, man pages and completions for every installed shell, asserted
  • a unit test installs two apps into one prefix and asserts each manifest holds only its own files
  • self uninstall of one app leaves the other's man pages and completions in place, end to end
  • a file changed after install is left behind and reported, end to end
  • lore installed through self install has a manifest

Found while taking #743's LKG. Orthogonal to that work; its own worktree.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions