Comments (10)
Known problem, documented in README.md
from bash-completion.
Just for the record, this is a different workaround with little clutter:
At the start of __reassemble_comp_words_by_ref
and _filedir
:
trap "set -$-" RETURN; set +o nounset
It doesn't solve the problem that 3rd-party completion scripts exhibit the same incompatibility, but for me it works fine and could be expanded to cover other shell options as well.
from bash-completion.
On 2nd thought, let's leave this open, maybe people notice better that way that it's a known issue.
from bash-completion.
Yes it's a known problem, but is there a planned fix or workaround for it ?
from bash-completion.
I'm not aware of anyone working on it. The workaround is not to use nounset
.
from bash-completion.
This is done now in the sense that I went through the test suite and have been using nounset
mode myself for a bit. It is likely that I didn't catch everything, but any remaining ones are considered bugs that need a fix from now on.
3rd party completions are affected too, I'm preparing to send a patch at least for git's completion soon once I gather some more confidence that I caught most of the issues.
from bash-completion.
Update: I figured it out, instead of the above solution of:
trap "set -$-" RETURN; set +o nounset
Use:
trap "set -${-//[is]}" RETURN; set +o nounset
..., eliminating the invalid flags and truly solving this problem!
With the above trap
solution in place from the above fix, I am now running into the following problem while trying to expand the (unique) name of a directory in the current directory:
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
-bash: set: -i: invalid option
Current BASH* vars from my environment are as follows:
BASH=/usr/local/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:globasciiranges:histappend:interactive_comments:login_shell:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=([0]="0")
BASH_ARGV=()
BASH_CMDS=()
BASH_COMPLETION_VERSINFO=([0]="2" [1]="8")
BASH_LINENO=()
BASH_REMATCH=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="5" [1]="0" [2]="7" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='5.0.7(1)-release'
To help troubleshoot, I turned on xtrace
with filename, line, and function enabled by changing $PS4 to help diagnose. When pressing TAB in an attempt to expand the name of a dir in the current directory, I get the source of the errors as follows:
...
+(/usr/share/bash-completion/bash_completion:17): _upvars(): eval 'words=("${@:3:2}")'
++(/usr/share/bash-completion/bash_completion:1): _upvars(): words=("${@:3:2}")
+(/usr/share/bash-completion/bash_completion:18): _upvars(): shift 4
+(/usr/share/bash-completion/bash_completion:7): _upvars(): (( 0 ))
++(/usr/share/bash-completion/bash_completion:1): _get_comp_words_by_ref(): set -himxBHs
-bash: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
+(/usr/share/bash-completion/bash_completion:25): _init_completion(): _variables
+(/usr/share/bash-completion/bash_completion:2): _variables(): [[ d =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]
...
+(/usr/share/bash-completion/bash_completion:64): _init_completion(): [[ -n '' ]]
+(/usr/share/bash-completion/bash_completion:66): _init_completion(): return 0
++(/usr/share/bash-completion/bash_completion:1): _init_completion(): set -himxBHs
-bash: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
+(/usr/share/bash-completion/bash_completion:5): _cd(): local 'IFS=
' i j k
+(/usr/share/bash-completion/bash_completion:7): _cd(): compopt -o filenames
+(/usr/share/bash-completion/bash_completion:11): _cd(): [[ -z '' ]]
+(/usr/share/bash-completion/bash_completion:12): _cd(): _filedir -d
...
+(/usr/share/bash-completion/bash_completion:15): _filedir(): [[ -d != -d ]]
+(/usr/share/bash-completion/bash_completion:35): _filedir(): [[ 0 -ne 0 ]]
++(/usr/share/bash-completion/bash_completion:1): _filedir(): set -himxBHs
-bash: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
+(/usr/share/bash-completion/bash_completion:13): _cd(): return
++(/usr/share/bash-completion/bash_completion:1): _cd(): set -himxBHs
-bash: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
I can't for the life of me figure out what is issuing this set -himxBHs
command!
Could anyone more familiar with how completion works please tell me what is using this -i
option and how I can remove it?
from bash-completion.
In case we dedicate somebody to work on this and fix it, will you accept the patch?
from bash-completion.
See discussion in #45
from bash-completion.
To facilitate looking into things by folks that are interested in this stuff, I pushed a new nounset
branch which runs the test suite in nounset
mode (failing spectacularly for now as expected), has #45 applied, and contains some initial bits to get the first unit test to succeed in that mode. Feel free to hack away and submit pull requests (as minimal/clean as possible) against that branch.
from bash-completion.
Related Issues (20)
- _comp_compgen_available_interfaces returns trailing colons HOT 6
- Available interface completion strips too much
- _split_longopt rename is breaking downstream (3rd party) completion scripts HOT 5
- scp remote path completion no longer working since 2.12 HOT 4
- Readline colors command completions as files (red blinking text) HOT 3
- Bash completions causing syntax error near unexpected token `(' HOT 7
- Nit HOT 3
- xargs HOT 1
- Hard to find where to report bugs HOT 2
- Latest CHANGELOG.md starts at `## 2.11...` and earlier HOT 2
- Redirection moved to the front wrongly affects completions HOT 2
- Gentoo update to 2.14 fails due to QA notice HOT 3
- tar file completion not working as expected under various option combinations HOT 2
- Enable .java Filename Completion for java Command HOT 2
- GCC tests fail on non-x86 platforms HOT 1
- CDPATH autocomplete is not working HOT 5
- 000_bash_completion_compat.bash sourced last in some locales HOT 1
- bash: _comp_initialize: command not found HOT 2
- [Regression] make autocompletion skips install HOT 3
- Native bash-completion 2 loader using complete -D HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bash-completion.