Skip to content

Disable /etc/bash_completion.d/redefine_filedir #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ else
set +v
fi

# Blacklisted completions, causing problems with our code.
#
_comp__init_blacklist_glob='@(acroread.sh)'

# Turn on extended globbing and programmable completion
shopt -s extglob progcomp

Expand Down Expand Up @@ -2463,11 +2459,11 @@ _comp_deprecate_func _xfunc _comp_xfunc
_comp__init_compat_dir=${BASH_COMPLETION_COMPAT_DIR:-/etc/bash_completion.d}
if [[ -d $_comp__init_compat_dir && -r $_comp__init_compat_dir && -x $_comp__init_compat_dir ]]; then
for _comp__init_file in "$_comp__init_compat_dir"/*; do
[[ ${_comp__init_file##*/} != @($_comp_backup_glob|Makefile*|$_comp__init_blacklist_glob) &&
[[ ${_comp__init_file##*/} != @($_comp_backup_glob|Makefile*|${BASH_COMPLETION_COMPAT_IGNORE-}) &&
-f $_comp__init_file && -r $_comp__init_file ]] && . "$_comp__init_file"
done
fi
unset -v _comp__init_compat_dir _comp__init_file _comp__init_blacklist_glob
unset -v _comp__init_compat_dir _comp__init_file

# source user completion file
#
Expand Down
26 changes: 26 additions & 0 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@ known hosts completion will omit hostnames from `HOSTFILE`. Omitting
hostnames from `HOSTFILE` is useful if `HOSTFILE` contains many entries for
local web development or ad-blocking.

### `BASH_COMPLETION_COMPAT_IGNORE`

Files in `BASH_COMPLETION_COMPAT_DIR` (the compat dir) to ignore, specified by
a glob pattern. The completion files in the compat dir whose basename matches
with this pattern will not be sourced by `bash_completion` at its load time.
This variable can be used to suppress the problematic completions. Note that
backup files and Makefiles in the compat dir are by default ignored regardless
of this setting.

One example is `acroread.sh` which is installed by some versions of Adobe
Reader, overrides `_filedir` with an incompatible version, and causes
various problems. To recover this `_filedir`, another completion file
`redefine_filedir` had been placed in the compat dir, which could also
cause another incompatibility when the user uses their own version of
bash-completion instead of the systemwide version. To suppress these files
one can set the following value:

```bash
export BASH_COMPLETION_COMPAT_IGNORE='@(acroread.sh|redefine_filedir)'
```

- <https://bugzilla.redhat.com/677446>
- <http://forums.adobe.com/thread/745833>
- <https://bugzilla.redhat.com/show_bug.cgi?id=1171396#c27>
- <https://github.com/scop/bash-completion/pull/667>

### `BASH_COMPLETION_CMD_CONFIGURE_HINTS`

If set and not null, `configure` completion will return the entire option
Expand Down
1 change: 1 addition & 0 deletions test/config/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export BASH_COMPLETION_USER_DIR=$(
)
# /var/empty isn't necessarily actually always empty :P
export BASH_COMPLETION_COMPAT_DIR=/var/empty/bash_completion.d
export BASH_COMPLETION_COMPAT_IGNORE='*'
export XDG_DATA_DIRS=/var/empty

# Make sure default settings are in effect
Expand Down