Files
magpie/.github/workflows
yetone c644d9f1d2 update: the downloaded binary is moved into place again while something still holds it after the trial start, not failed at once (#2272, JasonBuildAI)
InstallBinaryAside starts the download suspended (trialStart), ends
it, sets the running exe aside and renames the download over it. A
program that checks an executable as its process starts (an antivirus)
can hold the file a moment after the process has ended, and the rename
then fails with a sharing violation; the report says the first install
of every update failed this way. The rename (and the put-back of the
old exe on failure) now goes through moveIn, which tries again over
asideWaits (100 ms to 1.5 s) while Windows says the file is held
(errors 32/33), as moveAside already does for the running exe. Any
other failure is returned at once. The Windows CI step now runs the
trial tests too (TestTrialStart and the new ones).

What was run:
- Windows box (Windows 10.0.26200 x64, Defender real-time on, a
  cross-compiled update.test.exe in a temp dir with a sandbox
  USERPROFILE/APPDATA/LOCALAPPDATA/TEMP):
  - TestInstallBinaryWaitsForHeldDownload (new; the download held open
    for 150 ms): old update.go FAIL "rename ...magpie.exe.new
    ...magpie.exe: The process cannot access the file because it is
    being used by another process."; new PASS (0.31 s).
  - TestInstallBinaryRightAfterTheTrial (new; real trialStart, then the
    install) and TestTrialStart pass on old and new code there.
  - The whole update package passes; the CI pattern
    ^(TestInstallBinary|TestMoveAside|TestTrialStart) passes.
  - Rollback tests now use 1 ms waits so a file held for good fails
    fast.
- The real update, in a sandbox: v0.1.1243's magpie-windows-amd64.exe
  run as `magpie update` twice in separate sandbox homes: both updated
  to 0.1.1244, exit 0.
- macOS: gofmt -l clean; go vet darwin, GOOS=linux -tags nogui,
  GOOS=windows clean; go test -p 4 ./... (see the last commit of this
  push for the result).
Not reproduced: the hold itself. On this box the real trial-then-
install path succeeded every time (10/10 with a 12 MB exe, 10/10 with
a 74 MB magpie.exe, 2/2 real updates), and origin/main's TestTrialStart
passed 3/3. The fix is verified with an injected hold, not a real
antivirus one.
2026-10-15 10:10:18 +08:00
..