apex / up

Deploy infinitely scalable serverless apps, apis, and sites in seconds to AWS.
https://up.docs.apex.sh
MIT License
8.78k stars 374 forks source link

Fix `up upgrade` across partitions #329

Open kaihendry opened 6 years ago

kaihendry commented 6 years ago

Error: installing: moving: rename /tmp/unpackit-688898816/up /usr/local/bin/up: invalid cross-device link

And the workaround is not working either:

~$ curl -sfL https://raw.githubusercontent.com/apex/up/master/install.sh | sudo sh
apex/up: checking GitHub for latest version
apex/up: found version 0.2.4 for linux/amd64
apex/up: downloading https://github.com/apex/up/releases/download/v0.2.4/up_0.2.4_linux_amd64.tar.gz
apex/up: verifying checksums
curl: (22) The requested URL returned error: 404 Not Found
BenRayner commented 6 years ago

The v0.2.4 release has renamed the checksum file to up_0.2.4_checksums.txt instead of up_checksums.txt, which is causing the install.sh script to fail on a 404.

quocnguyen commented 6 years ago

workaround is that you fork install.sh and rename the checksum file to match the release. or you can use mine instead.

curl -sfL https://gist.githubusercontent.com/quocnguyen/4fdb93be6049f2311c7be6d2eaf90238/raw/7b85022f0ac5ff5fa72b7a0b8d21e955396ff4c7/install.sh | sh
tj commented 6 years ago

sorry about that! goreleaser must have made some small changes there, updated it recently

kaihendry commented 6 years ago

Regression with 0.2.5?

mbp:~ kaihendry$ curl -sfL https://raw.githubusercontent.com/apex/up/master/install.sh | sh
apex/up: checking GitHub for latest version
apex/up: found version 0.2.5 for darwin/amd64
apex/up: downloading https://github.com/apex/up/releases/download/v0.2.5/up_0.2.5_darwin_amd64.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
tj commented 6 years ago

@kaihendry are you still seeing that? I re-released the binaries (one was missing), but maybe GH's download server is confused now

kaihendry commented 6 years ago

@tj think it's working again. Upgraded successfully curl -sfL https://raw.githubusercontent.com/apex/up/master/install.sh | sh my mbp & t460s.

kaihendry commented 6 years ago

Oh btw, not sure how this got closed but this bug is still an issue on Archlinux!

Error: installing: moving: rename /tmp/unpackit-639905158/up /usr/local/bin/up: invalid cross-device link

Sidenote: I did notice https://aur.archlinux.org/packages/apex-bin/ but it seems horribly out of date. I wonder if it can be automated with a git hook or something...

tj commented 6 years ago

ah you can't do atomic renames across partitions. Hmm maybe we could detect that and fall back on just doing a copy. For now if you do cp /tmp/unpackit-639905158/up /usr/local/bin/up it should be ok I think

For now if anyone hits this you can use TMPDIR=/someother/dir up upgrade but that's not ideal

kaihendry commented 6 years ago

Why not a simple move file? e.g. https://github.com/kaihendry/lk2/blob/master/main.go#L339

tj commented 6 years ago

@kaihendry rename is atomic, so it either is successful or fails but never a partial failure which is unfortunately not true for copying—though honestly probably not a big deal in practice haha. It should at least fall back to a copy if rename can't be performed