shithub: rgbds

Download patch

ref: 12fed4c68ee081ac7ee7bac1954799f9baac104e
parent: 3db3421f070670e0f83ca0aad56dfa41a63d52f2
author: ISSOtm <[email protected]>
date: Tue Aug 9 18:30:50 EDT 2022

Harden Bash completion scripts against invalid states

Printing an error message is better than locking the shell up, honestly.

--- a/contrib/bash_compl/_rgbasm.bash
+++ b/contrib/bash_compl/_rgbasm.bash
@@ -209,6 +209,10 @@
 			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
 }
 
--- a/contrib/bash_compl/_rgbfix.bash
+++ b/contrib/bash_compl/_rgbfix.bash
@@ -175,6 +175,10 @@
 			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
 }
 
--- a/contrib/bash_compl/_rgbgfx.bash
+++ b/contrib/bash_compl/_rgbgfx.bash
@@ -161,6 +161,10 @@
 			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
 }
 
--- a/contrib/bash_compl/_rgblink.bash
+++ b/contrib/bash_compl/_rgblink.bash
@@ -151,6 +151,10 @@
 			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
 }