Skip to content

self-update backups accumulate without bound (.wpm/backup = 61.8 MB) #1208

Closed

Description

@caomengxuan666

What we see

.wpm\backup grows without bound. On a machine that has taken a handful of self-updates:

.wpm\backup\winuxcmd-before-update-11668.exe    ~4.1 MB
.wpm\backup\winuxcmd-before-update-12248.exe    ~4.1 MB
.wpm\backup\winuxcmd-before-update-12268.exe    ~4.1 MB
...
.wpm\backup  (total)                             61.8 MB

wpm update winuxcmd writes a fresh winuxcmd-before-update-<pid>.exe on every run (apply_update → unique_update_backup_path), including runs that end up reinstalling the same version. Nothing ever prunes them: wpm clean covers cache and staging only.

Related, on the same machine: the niubash install directory accumulates its own copies (niu.exe.bak-20261014, niu.exe.old-shposix, niu.exe.old2, niu.exe.prev, niu.exe.prev2 = 54.5 MB), which suggests the pattern is systemic rather than specific to wpm.

Why it matters

Not latency, but a silent multi-hundred-MB tax on every user, growing with each update, in a directory no tool surfaces. It also makes "which build am I actually running" harder to answer, since the directory is full of plausible images (this is how the stale-yes.exe investigation got confusing).

Suggested fix

  • Keep the newest one or two backups and prune older ones at the end of a successful update (unique_update_backup_path already knows the filename shape, so pruning is a sorted glob).
  • Include backup in wpm clean (either as a third target or folded into clean all), documenting that it removes the rollback copy.
  • Report the reclaimed bytes in the update summary, the way wpm clean already does.

Acceptance

  • Ten forced updates of the same version leave at most two backup files.
  • wpm clean all removes the backups and says how much it freed.
  • The rollback path still has a usable backup after every update (a test that forces a failed swap and checks the restore).

Activity

  1. added
    bug
    wpm
    on Oct 17, 2026
  2. added a commit that references this issue on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwpm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions