From 12fed4c68ee081ac7ee7bac1954799f9baac104e Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 9 Aug 2022 22:30:50 +0200 Subject: [PATCH] Harden Bash completion scripts against invalid states Printing an error message is better than locking the shell up, honestly. --- contrib/bash_compl/_rgbasm.bash | 4 ++++ contrib/bash_compl/_rgbfix.bash | 4 ++++ contrib/bash_compl/_rgbgfx.bash | 4 ++++ contrib/bash_compl/_rgblink.bash | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/contrib/bash_compl/_rgbasm.bash b/contrib/bash_compl/_rgbasm.bash index 4ec6cefc..2ae222eb 100755 --- a/contrib/bash_compl/_rgbasm.bash +++ b/contrib/bash_compl/_rgbasm.bash @@ -209,6 +209,10 @@ _rgbasm_completions() { done < <(compgen -A directory -- "${cur_word:$optlen}") compopt -o filenames ;; + *) + echo >&2 "Internal completion error: invalid state \"$state\", please report this bug" + return 1 + ;; esac } diff --git a/contrib/bash_compl/_rgbfix.bash b/contrib/bash_compl/_rgbfix.bash index 42c01214..938dd423 100755 --- a/contrib/bash_compl/_rgbfix.bash +++ b/contrib/bash_compl/_rgbfix.bash @@ -175,6 +175,10 @@ _rgbfix_completions() { done < <(compgen -A directory -- "${cur_word:$optlen}") compopt -o filenames ;; + *) + echo >&2 "Internal completion error: invalid state \"$state\", please report this bug" + return 1 + ;; esac } diff --git a/contrib/bash_compl/_rgbgfx.bash b/contrib/bash_compl/_rgbgfx.bash index 0032f1c7..87c598c5 100755 --- a/contrib/bash_compl/_rgbgfx.bash +++ b/contrib/bash_compl/_rgbgfx.bash @@ -161,6 +161,10 @@ _rgbgfx_completions() { done < <(compgen -A directory -- "${cur_word:$optlen}") compopt -o filenames ;; + *) + echo >&2 "Internal completion error: invalid state \"$state\", please report this bug" + return 1 + ;; esac } diff --git a/contrib/bash_compl/_rgblink.bash b/contrib/bash_compl/_rgblink.bash index 5d506f3b..0b800d0c 100755 --- a/contrib/bash_compl/_rgblink.bash +++ b/contrib/bash_compl/_rgblink.bash @@ -151,6 +151,10 @@ _rgblink_completions() { done < <(compgen -A directory -- "${cur_word:$optlen}") compopt -o filenames ;; + *) + echo >&2 "Internal completion error: invalid state \"$state\", please report this bug" + return 1 + ;; esac }