[GH-ISSUE #426] bash error in bash_completion.d/dust.bash after upgrade to v1.1.1 #186

Closed
opened 2026-06-08 11:26:02 +03:00 by zhus · 3 comments
Owner

Originally created by @jeffbski-rga on GitHub (Aug 7, 2024).
Original GitHub issue: https://github.com/bootandy/dust/issues/426

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
                    ;;
Originally created by @jeffbski-rga on GitHub (Aug 7, 2024). Original GitHub issue: https://github.com/bootandy/dust/issues/426 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 ```shell ${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. ```shell --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 ;; ```
zhus closed this issue 2026-06-08 11:26:02 +03:00
Author
Owner

@bootandy commented on GitHub (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.

<!-- gh-comment-id:2278517901 --> @bootandy commented on GitHub (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.
Author
Owner

@bootandy commented on GitHub (Apr 3, 2025):

Is this fixed now @jeffbski-rga ?- This code is autogenerated so I don't have much visibility on it.

<!-- gh-comment-id:2776423197 --> @bootandy commented on GitHub (Apr 3, 2025): Is this fixed now @jeffbski-rga ?- This code is autogenerated so I don't have much visibility on it.
Author
Owner

@bootandy commented on GitHub (Apr 20, 2025):

assuming fixed.

<!-- gh-comment-id:2817048630 --> @bootandy commented on GitHub (Apr 20, 2025): assuming fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#186