lucky_eagle_38410 on Discord (#general, 10-28): every run of the command
line wrote a new magpie.com. magpie.com is the console launcher from
2afacd7d1 (#3737): PowerShell and cmd run magpie.com before magpie.exe
(PATHEXT), and wait for it, so a prompt, a password and the exit code
reach the terminal; the GUI-linked magpie.exe alone gives the prompt back
at once. It is needed, and writeCom already writes it only when its bytes
differ.
They differed on every release. `make release-windows` built the
launcher from the git checkout with Go's default -buildvcs, which stamps
vcs.revision and vcs.time into the binary, so each release carried a
different magpie.com though the launcher's source hadn't changed, and the
first `magpie` after each update (several a day) wrote it again, moving a
running one aside as magpie.com.old. The launcher is now built with
-buildvcs=false, so magpie.com changes only when the launcher does.
Run:
- Windows box (xiaomi-gpu, PowerShell 5.1 over a ConPTY, sandbox
USERPROFILE/APPDATA, a folder of its own on PATH), the app run as
magpie.exe, then through magpie.com, then the next version copied over
magpie.exe and run again:
- real releases v0.1.1861 -> v0.1.1862: magpie.com 5F55B8D4... ->
2E6AD7D9..., rewritten on the update.
- make release-windows at origin/main 6e080ca04, at two commits of the
same tree: B26668C1... -> 15AD7512..., rewritten.
- make release-windows with this change, the same two commits:
782517C6... both times, mtime unchanged.
- mote: go test -tags nogui ./internal/update/...: ok. GOOS=windows and
GOOS=linux go vet ./internal/update/: ok. gofmt -l: clean.
- win-run: TestLauncherSameAtEveryCommit, TestWriteCom, TestComOwner,
TestEnsureCompanion, TestFindCLIPrefersCom pass on Windows.
Broken by hand: the Makefile without -buildvcs=false makes
TestLauncherSameAtEveryCommit red ("the launcher built at the next
commit differs ([-trimpath -ldflags=-s -w])"). The test builds a
program with the Makefile's launcher flags in a scratch git repo at two
commits and compares the bytes.
Not tried:
- A real release build in magpie-releases; the next tag is the first.
The first update to it still writes magpie.com once (its bytes change
from the stamped one); after that only a launcher change does.
- The arm64 build on a real ARM machine.
- The full go test ./...; only internal/update changed (a Makefile flag,
a comment and a test).