We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ca8148 commit 93b6676Copy full SHA for 93b6676
1 file changed
src/uu/df/src/df.rs
@@ -311,7 +311,11 @@ fn get_all_filesystems(opt: &Options) -> UResult<Vec<Filesystem>> {
311
// but `vmi` is probably not very long in practice.
312
if is_included(&mi, opt) && is_best(&mounts, &mi) {
313
let dev_path: &Path = Path::new(&mi.dev_name);
314
- if dev_path.is_symlink() {
+ // Only check is_symlink() for absolute paths. For non-absolute paths
315
+ // like "tmpfs", "sysfs", etc., is_symlink() would resolve relative to
316
+ // the current working directory, which is extremely slow in deeply
317
+ // nested directories (O(n) syscalls where n is the directory depth).
318
+ if dev_path.is_absolute() && dev_path.is_symlink() {
319
if let Ok(canonicalized_symlink) = uucore::fs::canonicalize(
320
dev_path,
321
uucore::fs::MissingHandling::Existing,
0 commit comments