File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,11 @@ fn get_all_filesystems(opt: &Options) -> UResult<Vec<Filesystem>> {
311311 // but `vmi` is probably not very long in practice.
312312 if is_included ( & mi, opt) && is_best ( & mounts, & mi) {
313313 let dev_path: & Path = Path :: new ( & mi. dev_name ) ;
314- if dev_path. is_symlink ( ) {
314+ // 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 ( ) {
315319 if let Ok ( canonicalized_symlink) = uucore:: fs:: canonicalize (
316320 dev_path,
317321 uucore:: fs:: MissingHandling :: Existing ,
You can’t perform that action at this time.
0 commit comments