Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3279,8 +3279,8 @@ impl App {
if o.cancelled
&& let Some(v) = &view
{
// The user asked for it, so it only tells.
self.note(format!("Stopped: {}", v.job.label));
// The user asked for it, so it only tells. A move taken back says so.
self.note(o.stopped.clone().unwrap_or_else(|| format!("Stopped: {}", v.job.label)));
}
if let (Some(v), [made]) = (&view, o.created.as_slice())
&& v.say_made
Expand Down
2 changes: 2 additions & 0 deletions crates/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ fn main() {
app.slow_read = std::env::var("GANNET_SLOW_READ_MS").ok().and_then(|v| v.parse().ok()).map(std::time::Duration::from_millis);
app.slow_preview = std::env::var("GANNET_SLOW_PREVIEW_MS").ok().and_then(|v| v.parse().ok()).map(std::time::Duration::from_millis);
app.engine.slow_copy = std::env::var("GANNET_SLOW_COPY_MS").ok().and_then(|v| v.parse().ok()).map(std::time::Duration::from_millis);
// So the end-to-end checks can fill a disk partway through a move.
app.engine.skip_space_check = std::env::var_os("GANNET_SKIP_SPACE_CHECK").is_some();
// So the end-to-end checks can ask about an archive of a few MiB.
if let Some(bytes) = std::env::var("GANNET_EXTRACT_ASK_AFTER").ok().and_then(|v| v.parse().ok()) {
app.engine.extract_limits.ask_after = bytes;
Expand Down
13 changes: 13 additions & 0 deletions crates/app/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ fn failures_go_to_stderr_with_exit_code_1() {
assert!(text(&out.stdout).ends_with(&want), "{}", text(&out.stdout));
}

#[test]
fn each_path_that_fails_gets_its_own_error() {
let h = Home::new("each-path");
// They fail alike, which the window tells as one notice, but here each keeps its path.
let out = h.gannet(&["trash", "--json", "a", "b", "c"]);
assert_eq!(out.status.code(), Some(1));
let json = text(&out.stdout);
for name in ["a", "b", "c"] {
assert!(json.contains(&format!("{{\"path\":\"{}\",", h.work().join(name).display())), "{name}: {json}");
}
assert!(!json.contains("\"path\":\"\""), "no error without its path: {json}");
}

#[test]
fn help_names_the_commands() {
let h = Home::new("help");
Expand Down
6 changes: 4 additions & 2 deletions crates/core/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,11 @@ fn trash_record(cfg: &TrashConfig, path: &Path) -> Option<Option<Info>> {
/// Runs one job in the operations engine, as the window would, and waits for it.
fn run_job(env: &Env, request: Request, report: &mut Report) -> Option<Outcome> {
let (tx, rx) = mpsc::channel();
let engine = Engine::new(env.trash.clone(), Arc::new(move |e| {
let mut engine = Engine::new(env.trash.clone(), Arc::new(move |e| {
let _ = tx.send(e);
}));
// Each path given gets its own result, not one message for all that failed alike.
engine.tell_each = true;
engine.start(request);
// Only the job's thread can send now, so a job that dies ends the wait instead of hanging it.
drop(engine);
Expand All @@ -359,7 +361,7 @@ fn run_job(env: &Env, request: Request, report: &mut Report) -> Option<Outcome>
let _ = q.reply.send(false);
}
// The window's advice about Shift+Delete means nothing here.
Event::Error { path, message, .. } => report.fail(Some(&path), message.trim_end_matches(" Shift+Delete deletes for good.")),
Event::Error { path, message, .. } => report.fail(Some(path.as_path()).filter(|p| !p.as_os_str().is_empty()), message.trim_end_matches(" Shift+Delete deletes for good.")),
Event::Finished(o) => return Some(o),
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub mod search;
pub mod servers;
pub mod settings;
pub mod sort;
pub mod space;
pub mod terminal;
pub mod theme;
pub mod thumbcache;
Expand Down
12 changes: 12 additions & 0 deletions crates/core/src/mounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ pub fn inodes_may_change(fs_type: &str) -> bool {
["nfs", "nfs4", "cifs", "smb3", "smbfs", "9p", "ceph", "glusterfs", "davfs"].contains(&fs_type) || fs_type.starts_with("fuse")
}

/// Whether a filesystem of this kind really gives a file another inode number from one look to
/// the next: a network share, or FUSE over a network. Narrower than [`inodes_may_change`],
/// which is for telling a folder apart and so also takes in any FUSE: a local FUSE drive, as
/// ntfs-3g (`fuseblk`) or exFAT, keeps its numbers.
pub fn inodes_renumbered(fs_type: &str) -> bool {
// Plain `fuse` says nothing about what's behind it, so it's left out, and taken as stable.
const NETWORK: [&str; 24] = [
"nfs", "nfs4", "cifs", "smb3", "smbfs", "9p", "ceph", "glusterfs", "davfs", "afs", "lustre", "vboxsf", "sshfs", "fuse.sshfs", "fuse.gvfsd-fuse", "fuse.rclone", "fuse.s3fs", "fuse.curlftpfs", "fuse.glusterfs", "fuse.ceph-fuse", "fuse.davfs", "fuse.mtpfs", "fuse.jmtpfs", "fuse.simple-mtpfs",
];
NETWORK.contains(&fs_type)
}

/// The mount point holding `path`, which should already be canonical.
pub fn mount_point_of(mounts: &[Mount], path: &Path) -> Option<PathBuf> {
mounts.iter().filter(|m| path.starts_with(&m.point)).max_by_key(|m| m.point.as_os_str().len()).map(|m| m.point.clone())
Expand Down
Loading
Loading