Skip to content

Commit

Permalink
improvement: ensure to communicate well to users when a "No space lef…
Browse files Browse the repository at this point in the history
…t on device occurs"

The new logic I made is always setting a temporary $CARGO_HOME to ensure
fetched packages came from a fresh environment which is deleted after the
operation is done. However, I haven't anticipated an issue where a user has
a `/tmp` or tmpfs that has a storage space of 1GB. That's too small and not
a bug.

If there are many bug reports like this, I might consider a solution but
since it's user-environment specific, it's a not-a-fix.

Signed-off-by: Soc Virnyl Estela <[email protected]>
  • Loading branch information
uncomfyhalomacro committed Dec 8, 2024
1 parent b439a64 commit 951b67a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cargo/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,24 @@ impl Opts {
run_cargo_vendor_home_registry(&setup_workdir, &custom_root, self)
}
Method::Vendor => run_cargo_vendor(&setup_workdir, &custom_root, self),
}?;
}.inspect_err(|err| {
match err.kind() {
io::ErrorKind::StorageFull => {
let dir = std::env::temp_dir();
error!(?err);
error!(
r#"🛑 Your `$TMPDIR` at {} has less storage space.
Ensure that your `$TMPDIR` at {} has a large storage space than the vendor, registry, and extracted or copied source code.
ℹ️ A workaround is setting `$TMPDIR` to another directory larger than the total size of your vendored tarball. For example,
```
export TMPDIR="$HOME/.cache"
osc service -vvv mr cargo_vendor
```
"#, dir.display(), dir.display());
}
_ => error!(?err)
}
})?;
} else {
let mut msg: String =
"It seems that the setup workdir is not a directory or does not exist.".to_string();
Expand Down

0 comments on commit 951b67a

Please sign in to comment.