[pacman-dev,1/2] pacman-key: when refreshing gpg.conf, don't truncate option checking

Message ID 20190805165310.4140-1-eschwartz@archlinux.org
State Accepted, archived
Headers show
Series
  • [pacman-dev,1/2] pacman-key: when refreshing gpg.conf, don't truncate option checking
Related show

Commit Message

Eli Schwartz Aug. 5, 2019, 4:53 p.m. UTC
If an option is a two-part option, we print both (separated by IFS=' '),
but when grepping to see if it already exists, we only checked the first
component. This means that something like keyserver-options could only
check if there were existing keyserver options of any sort, but not
which ones.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 scripts/pacman-key.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index b05754e5..c3b02850 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -169,7 +169,7 @@  add_gpg_conf_option() {
 	local conffile=$1; shift
 	# looking for the option 'bare', only leading spaces or # chars allowed,
 	# followed by at least one space and any other text or the end of line.
-	if ! grep -q "^[[:space:]#]*$1\([[:space:]].*\)*$" "$conffile" &>/dev/null; then
+	if ! grep -q "^[[:space:]#]*$*\([[:space:]].*\)*$" "$conffile" &>/dev/null; then
 		printf '%s\n' "$*" >> "$conffile"
 	fi
 }