Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/uu/df/src/df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore itotal iused iavail ipcent pcent tmpfs squashfs lofs
// spell-checker:ignore itotal iused iavail ipcent pcent tmpfs squashfs lofs sysfs
mod blocks;
mod columns;
mod filesystem;
Expand Down Expand Up @@ -311,7 +311,11 @@ fn get_all_filesystems(opt: &Options) -> UResult<Vec<Filesystem>> {
// 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() {
// Only check is_symlink() for absolute paths. For non-absolute paths
// like "tmpfs", "sysfs", etc., is_symlink() would resolve relative to
// the current working directory, which is extremely slow in deeply
// nested directories (O(n) syscalls where n is the directory depth).
if dev_path.is_absolute() && dev_path.is_symlink() {
if let Ok(canonicalized_symlink) = uucore::fs::canonicalize(
dev_path,
uucore::fs::MissingHandling::Existing,
Expand Down
Loading