nianshou5 on Discord (#help, Windows): magpie.com and magpie.exe.new
showed on the Desktop and came back after being deleted. Both were
written beside magpie.exe:
- magpie.exe.new is the update the GUI downloads as soon as it is out
and swaps in at the next restart. StageBinary put it beside the
program whenever that folder was writable, so it sat on the Desktop
until a restart, and a deleted one was downloaded again by the next
check.
- magpie.com (#3737) is written at every start while the app's folder
is on PATH, and Settings > Command line's Add puts that folder on
PATH, so deleting it on the Desktop lasted until the next start.
Now:
- StageBinary downloads into magpie's cache, in a folder of this
program's own (update/<hash of the exe path>), when a rename from
there reaches the program's folder (renamesInto, a real probe: the
swap must stay one rename on one volume). With the cache on another
volume it goes into a hidden .magpie-update folder beside the program
(FILE_ATTRIBUTE_HIDDEN on Windows). A folder magpie may not write is
unchanged (cache, moved in as administrator). The stage folder is
removed after the swap or a failed download.
- At start RemoveStaleNew looks in every place a download may be,
magpie.exe.new beside the program included, and removes one no newer
than the running version (same bytes, or an older file version); a
newer one stays, as before.
- Settled (the installed copy opened from a Desktop/Downloads one)
also removes the update downloaded for that one, which nothing will
put in now.
- In a download folder (Desktop, Downloads, a temp folder, as
isDownloadFolder already says) a start only keeps an existing
magpie.com up to date and never writes a missing one; Add still
writes it. Any other folder on PATH is as before. A Desktop
magpie.exe that opens the installed one (Settle) already wrote none.
Run:
- Windows (win-run, xiaomi-gpu, sandbox HOME from testenv), a repro
test with the running test binary standing for magpie.exe on a
Desktop on PATH: at origin/main 72ed121fd StageBinary staged
test.test.exe.new beside it, and magpie.com came back after delete +
start; with this change the download was in
AppData\Local\magpie\update\<hash>\ and magpie.com stayed gone.
- Windows: a real program (whoami.exe) staged into the cache passed the
real trial start (canStart) and was swapped in for a Desktop
magpie.exe with the real moveAside/moveIn; the stage folder was gone
after.
- At the pushed head (rebased on d6beb9975): go test ./internal/update
on mote and on Windows: ok. Before the rebase also on Linux (wsl-run). gofmt, go vet ./internal/update (darwin, linux, windows),
GOOS=windows go vet ./internal/gui ./internal/cli: clean.
- go test ./internal/gui ./internal/cli on Windows: TestUpdateThatWontStart,
TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown,
TestAionUiImportRow (#4115), TestGatewayHeldByAContainer (#2107,
#3649) and TestLibraryMCPHub (#4140) red, the same 6 when run at
origin/main 72ed121fd.
- Full suite on mote (-timeout 45m): started at the pre-rebase tree
(same update changes, base 72ed121fd) and still running at push; its
result and any red go in a follow-up.
Broken by hand: staging back beside the exe, the download-folder rule
in EnsureCompanion off, removeStaged out of Settled: the new tests
(TestUpdateStagedOutOfTheProgramsFolder, TestUpdateStagedHiddenWithoutTheCache,
TestStartClearsAnOlderDownloadBeside, TestNoCompanionPutBackOnTheDesktop,
TestSettledClearsOnlyMagpiesFiles, TestNoCompanionBesideAForwardingDownload)
went red.
Not tried: a real GUI self-update of a release build on the Windows
desktop, a cache and Desktop on separate real volumes (the hidden
fallback was tested with no cache), the reporter's own machine, and a
real terminal's `magpie` (unchanged code outside download folders).