Commit b9f5a79
committed
Fix infinite recursion in bash completions when
Previously, running `source /etc/bash_completion.d/cargo` would loop
forever:
```
Command 'rustc' not found, but can be installed with:
sudo snap install rustup # version 1.24.3, or
sudo apt install rustc # version 1.47.0+dfsg1+llvm-1ubuntu1~20.04.1
See 'snap info rustup' for additional versions.
Command 'rustc' not found, but can be installed with:
sudo snap install rustup # version 1.24.3, or
sudo apt install rustc # version 1.47.0+dfsg1+llvm-1ubuntu1~20.04.1
See 'snap info rustup' for additional versions.
Command 'rustc' not found, but can be installed with:
```
The issue was that `$(rustc --print sysroot)/etc/bash_completion.d/cargo`
will expand to `/etc/bash_completion.d/cargo` is rustc doesn't print
anything, which sources the same file over and over. This fixes it by
first checking that rustc exists.
This also adds quotes around the sysroot, to support spaces with
filenames.rustc is not in PATH1 parent 457d643 commit b9f5a79
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1686 | 1686 | | |
1687 | 1687 | | |
1688 | 1688 | | |
1689 | | - | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
1690 | 1692 | | |
1691 | 1693 | | |
1692 | 1694 | | |
| |||
0 commit comments