Skip to content

uninstall: no protected-location guard on config/data/cache roots, and the shared-cache warning disappears when a root contains it #531

Open

Description

@rominf

Current behavior

rocm uninstall removes the config, data and cache roots through remove_path without the protected-location check that rocm storage remove-old-installs applies (runtime_install_root_is_protected). The roots come from ROCM_CLI_{CONFIG,DATA,CACHE}_DIR, or for the data root from setup.therock_venv in config.json, which install sdk --prefix P sets to P. So:

  • ROCM_CLI_DATA_DIR=/ plans 1 item(s) would be removed: - data: / (dry run).
  • setup.therock_venv set to $HOME plans - data: <home>, and with --yes deleted the whole (sandboxed) home directory.

The plan does list these paths and asks for confirmation, so the deletion isn't silent. But it labels them "data" with no warning, and the same root is refused elsewhere in the CLI.

A more plausible case: with ROCM_CLI_CACHE_DIR=~/.cache, the plan's "Please review" notes for ~/.cache/uv and ~/.cache/huggingface/hub disappear. shared_cache_notes_for filters out shared caches inside a root being removed, so the warnings vanish exactly when those caches are about to be deleted. With --yes, all of ~/.cache was deleted, Hugging Face model weights included.

Expected behavior

  • rocm uninstall refuses, or at least loudly flags, any root that is /, the home directory, or another protected location, as remove-old-installs already does.
  • When a removed root contains a shared cache, the plan says that cache will be deleted rather than dropping the note.

Steps to reproduce (use a throwaway HOME)

  1. ROCM_CLI_CACHE_DIR=$HOME/.cache rocm uninstall --dry-run shows no Hugging Face/uv note. Compare with the default cache dir, which shows both.
  2. ROCM_CLI_DATA_DIR=/ rocm uninstall --dry-run plans to remove /.

Possible solution

Run each planned root through the same runtime_install_root_is_protected check (#189 tracks gaps in that list; it notes the home directory itself is unprotected) and refuse protected ones. In shared_cache_notes_for, turn "this cache is inside a root being removed" into an explicit warning instead of filtering it out.

Related

#189, #163, #490.

Environment

Built from main. Platform-independent.

How it was found

Property-testing recursive-deletion sites against a real filesystem (the property shrank to cache_dir = $HOME), then reproduced with the built binary in a sandbox.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions