From dfc44b10685d94c709738cee7de33dcd5a78cc76 Mon Sep 17 00:00:00 2001 From: fluvf <14368815+fluvf@users.noreply.github.com> Date: Sun, 17 Dec 2023 12:53:27 +0200 Subject: [PATCH] read_config_paths: Don't validate entry IDs Not strictly up-to spec, but also won't break anything An invalid ID should never have an alias set, as `find_entry_paths` prunes them I feel like this sort of user error isn't worth maintaining code to check for, as the config line plain not working feels obvious enough It's also easier to comprehend when reading --- xdg-terminal-exec | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/xdg-terminal-exec b/xdg-terminal-exec index c7a76bc..0485dc9 100755 --- a/xdg-terminal-exec +++ b/xdg-terminal-exec @@ -189,11 +189,7 @@ read_config_paths() { # Let `read` trim leading/trailing whitespace from the IDs while IFS=":$OIFS" read -r entry_id action_id; do case $entry_id in - # Ignore comments - '#'*) ;; - # Catch directives first - - # cache control + # Directives to toggle cache /enable_cache) debug "directive $entry_id ${XTE_CACHE_ENABLED+'(ignored)'}" CACHE_ENABLED=${XTE_CACHE_ENABLED-true} @@ -202,20 +198,8 @@ read_config_paths() { debug "directive $entry_id ${XTE_CACHE_ENABLED+'(ignored)'}" CACHE_ENABLED=${XTE_CACHE_ENABLED-false} ;; - - # `[The extensionless entry filename] should be a valid D-Bus well-known name.` - # `a sequence of non-empty elements separated by dots (U+002E FULL STOP), - # none of which starts with a digit, and each of which contains only characters from the set [a-zA-Z0-9-_]` - # Stricter parts seem to be related only to reversed DNS notation but not common naming - # i.e. there is `2048-qt.desktop`. - # I do not know of any terminal that starts with a number, but it's valid. - - # Catch and error on invalid entry ID - *[![:alnum:]_.-]*'.desktop' | '.desktop' | '') - error "Discarded invalid, possibly misspelled, entry ID '$entry_id'" - ;; - # Catch valid entry ID - [[:alnum:]_]*'.desktop') + # Catch entry ID + [!#]*'.desktop') READ_ENTRY_IDS=${READ_ENTRY_IDS:+${READ_ENTRY_IDS}${N}}$entry_id:$action_id debug "$entry_id : $action_id" ;;