Giter Club home page Giter Club logo

Comments (10)

scop avatar scop commented on July 16, 2024 6

Known problem, documented in README.md

from bash-completion.

jwalt avatar jwalt commented on July 16, 2024 3

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.

scop avatar scop commented on July 16, 2024 2

On 2nd thought, let's leave this open, maybe people notice better that way that it's a known issue.

from bash-completion.

siteshwar avatar siteshwar commented on July 16, 2024 2

Yes it's a known problem, but is there a planned fix or workaround for it ?

from bash-completion.

scop avatar scop commented on July 16, 2024 2

I'm not aware of anyone working on it. The workaround is not to use nounset.

from bash-completion.

scop avatar scop commented on July 16, 2024 2

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.

SteelBlueVision avatar SteelBlueVision commented on July 16, 2024 1

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.

deekej avatar deekej commented on July 16, 2024

In case we dedicate somebody to work on this and fix it, will you accept the patch?

from bash-completion.

scop avatar scop commented on July 16, 2024

See discussion in #45

from bash-completion.

scop avatar scop commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.