Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/uu/df/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ path = "src/df.rs"

[dependencies]
clap = { workspace = true }
uucore = { workspace = true, features = ["libc", "fsext", "parser"] }
uucore = { workspace = true, features = ["libc", "fsext", "parser", "fs"] }
unicode-width = { workspace = true }
thiserror = { workspace = true }
fluent = { workspace = true }
Expand Down
13 changes: 12 additions & 1 deletion src/uu/df/src/df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,24 @@ fn get_all_filesystems(opt: &Options) -> UResult<Vec<Filesystem>> {
}

let mut mounts = vec![];
for mi in read_fs_list()? {
for mut mi in read_fs_list()? {
// TODO The running time of the `is_best()` function is linear
// in the length of `result`. That makes the running time of
// this loop quadratic in the length of `vmi`. This could be
// improved by a more efficient implementation of `is_best()`,
// but `vmi` is probably not very long in practice.
if is_included(&mi, opt) && is_best(&mounts, &mi) {
let dev_path: &Path = Path::new(&mi.dev_name);
if dev_path.is_symlink() {
if let Ok(canonicalized_symlink) = uucore::fs::canonicalize(
dev_path,
uucore::fs::MissingHandling::Existing,
uucore::fs::ResolveMode::Logical,
) {
mi.dev_name = canonicalized_symlink.to_string_lossy().to_string();
}
}

mounts.push(mi);
}
}
Expand Down
Loading