]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: Exclude /dev/fd from fsck find
authorKevin Locke <kevin@kevinlocke.name>
Mon, 30 Oct 2017 19:50:51 +0000 (13:50 -0600)
committerKevin Locke <kevin@kevinlocke.name>
Mon, 30 Oct 2017 20:12:55 +0000 (14:12 -0600)
When the bash-completion for fsck runs `find -L /dev/ -type b` it
descends into /dev/fd after opening '.' as file descriptor 3.  This
causes find to search through /dev/fd/3/ which includes everything below
the current directory, which can take a very long time.

To avoid this, prune /dev/fd in the find expression.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
bash-completion/fsck

index 816422f52fa6d46ca9e57dff72c7a1d32e7ffc86..e5b4f53b4de7a1703d5fa6eaa08e4d44c08ab992 100644 (file)
@@ -32,7 +32,8 @@ _fsck_module()
                        return 0
                        ;;
        esac
-       COMPREPLY=( $(compgen -W "$(find -L /dev/ -type b 2>/dev/null)" -- $cur) )
+       COMPREPLY=( $(compgen -W "$(find -L /dev/ -path /dev/fd -prune \
+               -o -type b -print 2>/dev/null)" -- $cur) )
        return 0
 }
 complete -F _fsck_module fsck