Skip to content
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

bash error in bash_completion.d/dust.bash after upgrade to v1.1.1 #426

Open
jeffbski-rga opened this issue Aug 7, 2024 · 1 comment
Open

Comments

@jeffbski-rga
Copy link

After upgrading to the latest version 1.1.1, I started getting the error from bash_completion/dust.bash:

-bash: /usr/local/etc/bash_completion.d/dust.bash: line 62: conditional binary operator expected
-bash: /usr/local/etc/bash_completion.d/dust.bash: line 62: syntax error near `IFS'
-bash: /usr/local/etc/bash_completion.d/dust.bash: line 62: `                    if [[ -v IFS ]]; then'

I am on Mac OS 14.5 with GNU bash, version 5.2.32(1)-release (x86_64-apple-darwin23.4.0)

I also get the same result if I use the native Mac GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin23)

In looking for a solution I found this stack exchange post https://unix.stackexchange.com/questions/264926/is-it-a-sane-approach-to-back-up-the-ifs-variable

${IFS+"false"} && unset oldifs || oldifs="$IFS"    # correctly store IFS.

IFS="error"                 ### change and use IFS as needed.

${oldifs+"false"} && unset IFS || IFS="$oldifs"    # restore IFS.

So If I use this technique to save and restore IFS in the script, I don't see the error.

Here is the new code with the old code commented out.

                --ignore-all-in-file)
                    ${IFS+"false"} && unset oldifs || oldifs="$IFS"
                    # local oldifs
                    # if [[ -v IFS ]]; then
                    #     oldifs="$IFS"
                    # fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    ${oldifs+"false"} && unset IFS || IFS="$oldifs"
                    # if [[ -v oldifs ]]; then
                    #     IFS="$oldifs"
                    # fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
                -I)
                    ${IFS+"false"} && unset oldifs || oldifs="$IFS"

                    # local oldifs
                    # if [[ -v IFS ]]; then
                    #     oldifs="$IFS"
                    # fi
                    IFS=$'\n'
                    COMPREPLY=($(compgen -f "${cur}"))
                    ${oldifs+"false"} && unset IFS || IFS="$oldifs"

                    # if [[ -v oldifs ]]; then
                    #     IFS="$oldifs"
                    # fi
                    if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
                        compopt -o filenames
                    fi
                    return 0
                    ;;
@bootandy
Copy link
Owner

bootandy commented Aug 9, 2024

the completion code is auto generated and we've had some trouble with the zsh version, I'll try upgrading the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants