atlanticaccent / starsector-mod-manager-rust

A mod manager for Starsector, a space fleet-battle and economics simulator. This time written in Rust.
https://atlanticaccent.github.io/starsector-mod-manager-rust/
MIT License
34 stars 0 forks source link

Webview downloads fail on Linux due to a persist error #160

Closed atlanticaccent closed 2 years ago

atlanticaccent commented 2 years ago

Okay, as I noted in the PR, it seems that the error which occurs when using the web browser is actually different from the one when extracting the archive. The web browser experiences an issue well before the archive extraction does. https://github.com/atlanticaccent/starsector-mod-manager-rust/pull/159 will fix the archive extraction.

The web browser error, when trying to install nexerelin, is as follows:

Navigation: https://fractalsoftworks.com/forum/index.php?topic=9175.0
Client answered: Download("https://github.com/Histidine91/Nexerelin/releases/download/v0.10.4d/Nexerelin_0.10.4d.zip")
Navigation: https://fractalsoftworks.com/forum/index.php?topic=9175.0
thread 'tokio-runtime-worker' panicked at 'Persist download: PersistError { error: Os { code: 18, kind: CrossesDevices, message: "Invalid cross-device link" }, file: NamedTempFile("/tmp/.tmp3sbLmg") }', src/app.rs:881:47

It may be worth making this ticket specifically about the archive issue and creating a new one for the web browser problem.

Originally posted by @TheDukeofErl in https://github.com/atlanticaccent/starsector-mod-manager-rust/issues/158#issuecomment-1145468797

atlanticaccent commented 2 years ago

The error message CrossesDevices makes me think that for some reason, calling persist is causing the folder to be persisted on a different disk than the temp directory. That would imply that the OS has been installed on one drive/device, but been configured to keep it's default tmp directory on another drive/device - which I have to say is unusual.

I'll see if there might be some way to abstract over this edge case and prevent this

TheDukeofErl commented 2 years ago

That would imply that the OS has been installed on one drive/device, but been configured to keep it's default tmp directory on another drive/device - which I have to say is unusual.

This is standard practice on a Linux-based system. /tmp isn't really the same disk as the rest of the mounts, per se. It's actually it's own filesystem. A sample mount command would output something similar to this

tmpfs on /tmp type tmpfs
/dev/sda3 on / type ext4

In this (simplified) sample mount output, disk sda3 is mounted at root, covering the root dir and home dirs (/home). With this in mind, it seems that /tmp is being considered a different device. I don't think I've ever seen any *nix setup that has the /tmp dir actually mounted to the physical disk. tmpfs is very much temporary: it is always lost upon reboot. I imagine that rust has some built-in way to try to deal with this, as I'd be willing to wager other projects have run into this in the past. If nothing else, hopefully this explanation helps you figure something out.