Self-update (Windows) started failing after release of 0.15

We use restic on a set of Windows servers, running daily automatic updates using self-update.

Since the release of 0.15, the previous version (on all servers) stopped working.

We do restic self-update --output restic-next.exe and it suddenly fails everywhere with:

writing restic to C:\Path\To\Restic\restic-next.exe
find latest release of restic at GitHub
latest version is 0.15.0
download SHA256SUMS
download SHA256SUMS.asc
GPG signature verification succeeded
download restic_0.15.0_windows_amd64.zip
downloaded restic_0.15.0_windows_amd64.zip
Fatal: unable to update restic: unable to rename target file: rename C:\Path\To\Restic\restic-next.exe C:\Path\To\Restic\restic-next.exe.bak: The system cannot find the file specified.

Any help hightly appreciated.

Additional information:

I can constanly reproduce it even locally on my Windows 10 machine:

Create an empty folder and fetch 14.0:
curl -Ls --output restic.zip https://github.com/restic/restic/releases/download/v0.14.0/restic_0.14.0_windows_amd64.zip

Extract to restic.exe
Then run restic self-update --output restic-next.exe

Note: it working using 12.1. So do the same as above, but download 12.1 instead, and everything works. So combo 14.0 upgrading to 15.0 seem to be the problem.

hi,
i can reproduce.

after the failure, there is a new file in dir named restic3666372939

cmd /c restic3666372939 version
restic 0.15.0 compiled with go1.19.5 on windows/amd64
2 Likes

As a workaround you could create an empty file with name restic-next.exe, afterwards restic self-upgrade --output restic-next.exe should work.

The restic3666372939 file will work after renaming it to restic.exe. It is only the final rename operation which is missing.

Should be fixed self-upgrade: Fix handling of `--output` on windows by MichaelEischer · Pull Request #4163 · restic/restic · GitHub

3 Likes

Thanks @MichaelEischer for the help.

The suggested workaround worked when I tested it. We can adopt that I think.
I comes with a side-effect that it leaves a restic-next.exe.bak behind (a copy of the dummy file), but it’s not a real problem.

Cheers.