From 94f6e7d4a69b3016a6faa318736fd61c6d115064 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Mon, 26 Dec 2022 02:01:48 +0400 Subject: [PATCH] Reinstate selfupdate tag to make builds without self-update work Revert what seems to be a typo introduced as part of the fix for #2041 in 2018 7d0f2eaf24cffe6f45d7980a39791a08f5ba4d8e. `xbuild` does not look like a go build/tag keyword to me, I failed to find documentation for it and using `go install -tags '!selfupdate' ...` has no effect, i.e. self-update code is still compiled. `+build` however works; updating the OpenBSD port/binary package security/restic to apply this PR works as expected: ``` $ restic help | grep self $ restic self-update unknown command "self-update" for "restic" ``` (Using `go:build` now as per restic's style and gofmt.) Previously, using `restic-0.14.0p1` on OpenBSD/amd64 7.2-current would check for a newer version and probably attempt replacing the system wide root-owned executable (on a read-only filesystem) as unprivileged user: ``` $ restic version restic 0.14.0 compiled with go1.19.2 on openbsd/amd64 $ restic help | grep self self-update Update the restic binary $ restic self-update writing restic to /usr/local/bin/restic find latest release of restic at GitHub restic is up to date ``` (It never tried to actually write besaid path; doing so would fail, so the current message can be considered misleading.) --- cmd/restic/cmd_self_update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/restic/cmd_self_update.go b/cmd/restic/cmd_self_update.go index 23345a97c..4b86c416f 100644 --- a/cmd/restic/cmd_self_update.go +++ b/cmd/restic/cmd_self_update.go @@ -1,4 +1,4 @@ -// xbuild selfupdate +//go:build selfupdate package main