kimono-koans / httm

Interactive, file-level Time Machine-like tool for ZFS/btrfs/nilfs2 (and even Time Machine and Restic backups!)
https://crates.io/crates/httm
Mozilla Public License 2.0
1.33k stars 28 forks source link

Release 0.13.0 does not compile #44

Closed jimsalterjrs closed 2 years ago

jimsalterjrs commented 2 years ago

When attempting to build from source:

   Compiling httm v0.13.0 (/home/me/httm)
error[E0716]: temporary value dropped while borrowed
   --> src/utility.rs:286:26
    |
286 |     let mut out_locked = std::io::stdout().lock();
    |                          ^^^^^^^^^^^^^^^^^       - temporary value is freed at the end of this statement
    |                          |
    |                          creates a temporary which is freed while still in use
287 |     write!(out_locked, "{}", output_buf)?;
    |     ------------------------------------ borrow later used here
    |
    = note: consider using a `let` binding to create a longer lived value

For more information about this error, try `rustc --explain E0716`.
error: could not compile `httm` due to previous error
cargo-deb: build failed
jimsalterjrs commented 2 years ago

0.12.11 built and installed fine on the same machine, btw. (Ubuntu 20.04)

kimono-koans commented 2 years ago

Jim, appreciate you taking the time to build from sources, and to file this bug. Know the extra work is not ideal for any user.

My best guess is that this is related to the version of Rust you have installed. Did you install Rust from apt instead of rustup? I believe this code builds with the latest Rust 1.62. Maybe run rustup update if you did install Rust via rustup? If you didn't, yes, this is probably an example of the faster moving Rust ecosystem moving faster than the distributions' packaging.

FYI, sidebar, many Rust packages have a minimum supported Rust version (MSV) they test against and with which they guarantee compatibility. Say versions 1.5 or 1.42. I don't, because I always update to the latest stable Rust version. This is really about me trying to keep httm simple for me.

This is definitely something that could also be checked in a CI/CD pipeline with a GitHub action to just build against the MSV. GitHub actions and CI/CD are not currently on my to-do, but maybe they should be, along with better tests integrated in the repo.

kimono-koans commented 2 years ago

This had a pretty simple fix for 1.59 and should build on 20.04 now. See: https://github.com/kimono-koans/httm/commit/580307a3210f11b6927c3e2d1ed8b65cd775c9f1

To install the latest bits, without cloning the repo, use: cargo install --git https://github.com/kimono-koans/httm

jimsalterjrs commented 2 years ago

My best guess is that this is related to the version of Rust you have installed. Did you install Rust from apt instead of rustup?

I first performed the rustup installation as suggested. But when I tried to use cargo in the next step, the machine complained about having no such command available, and offered apt install cargo as a way to get it.

I did a quick check to make sure cargo hadn't simply been put in /opt or something, could not find it, then did apt install cargo. After that, the cargo commands worked, but neither building from master nor building from the source for 0.13.0 worked; both produced the same error shown above.

Dropping back to 0.12.11 did work; beginning from the source for that release cargo deb finished without complaint, and dpkg -i on the deb produced resulted in a working httm binary.

kimono-koans commented 2 years ago

I first performed the rustup installation as suggested. But when I tried to use cargo in the next step, the machine complained about having no such command available, and offered apt install cargo as a way to get it.

That's interesting. FYI, it should install to .cargo/bin and add that directory to your path, for me, via . "$HOME/.cargo/env" to my .zshenv. Yeah, might have hit an rustup install bug.

kimono-koans commented 2 years ago

I'm closing these both, as I'm now using a GH action to build both Redhat and Debian packages on Ubuntu 18.04. Should work on most distros now.

See: https://github.com/kimono-koans/httm/blob/master/.github/workflows/package-build.yml

Feel free to reopen if you you think additional comments are necessary. Thanks Jim!