Skip to content

Bash completions don't work #12409

@sealor

Description

@sealor

Problem

The Bash completions don't work because they are not be sourced correctly.

Steps

Rustup expects Bash completions in ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/etc/bash_completion.d/cargo:

$ rustup completions bash cargo
if command -v rustc >/dev/null 2>&1; then
        source "$(rustc --print sysroot)"/etc/bash_completion.d/cargo
fi

Unfortunately, the completions are not there:

$ ls -d "$(rustc --print sysroot)"/etc/bash_completion.d/cargo
ls: cannot access '/home/stefan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/etc/bash_completion.d/cargo': No such file or directory

But, the completions are here:

$ file "$(rustc --print sysroot)"/src/etc/bash_completion.d/cargo
/home/stefan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/src/etc/bash_completion.d/cargo: ASCII text

Note the /src/etc instead of just /etc.

Possible Solution(s)

The Bash completions should be placed in /etc/bash_completion.d/cargo instead of /src/etc/bash_completion.d/cargo.

Notes

No response

Version

$ cargo --version
cargo 1.71.0 (cfd3bbd8f 2023-06-08)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionsArea: shell completionsC-bugCategory: bugS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions