From d95c04945fc85bcc584026f7fded57dc8724ba6a Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Thu, 22 Dec 2011 17:46:47 +1000 Subject: [PATCH 1/2] Allow comments after repo section header in pacman.conf Pacman assumes that the final character of a line specifing a repo in pacman.conf is a "]". But it did not clean whitespace from the line after removing any comments. So lines like: [allanbrokeit] # could break system caused pacman not to recognize the repo. Adjust config parsing to strip comments before trimming whitespace from the end of the string. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- src/pacman/conf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index a4d115dd..a9f0de91 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -719,16 +719,18 @@ static int _parseconfig(const char *file, struct section_t *section, size_t line_len; linenum++; + + /* ignore whole line and end of line comments */ + if((ptr = strchr(line, '#'))) { + *ptr = '\0'; + } + strtrim(line); line_len = strlen(line); - /* ignore whole line and end of line comments */ - if(line_len == 0 || line[0] == '#') { + if(line_len == 0) { continue; } - if((ptr = strchr(line, '#'))) { - *ptr = '\0'; - } if(line[0] == '[' && line[line_len - 1] == ']') { char *name; From 5b749eeee999b5b332ad7545688297a37542b9a5 Mon Sep 17 00:00:00 2001 From: Timothy Redaelli Date: Fri, 23 Dec 2011 17:52:11 +0100 Subject: [PATCH 2/2] pacman-key: Add missing quotes Signed-off-by: Timothy Redaelli Signed-off-by: Dan McGee --- scripts/pacman-key.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index ee43dde1..f358c487 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -450,9 +450,9 @@ fi # file, falling back on a hard default PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(get_from "$CONFIG" "GPGDir" "@sysconfdir@/pacman.d/gnupg")} -GPG_PACMAN=(gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning) +GPG_PACMAN=(gpg --homedir "${PACMAN_KEYRING_DIR}" --no-permission-warning) if [[ -n ${KEYSERVER} ]]; then - GPG_PACMAN+=(--keyserver ${KEYSERVER}) + GPG_PACMAN+=(--keyserver "${KEYSERVER}") fi # check only a single operation has been given @@ -492,7 +492,7 @@ fi (( POPULATE )) && populate_keyring (( RECEIVE )) && "${GPG_PACMAN[@]}" --recv-keys "${KEYIDS[@]}" (( REFRESH )) && "${GPG_PACMAN[@]}" --refresh-keys "${KEYIDS[@]}" -(( VERIFY )) && "${GPG_PACMAN[@]}" --verify $SIGNATURE +(( VERIFY )) && "${GPG_PACMAN[@]}" --verify "$SIGNATURE" if (( UPDATEDB )); then msg "$(gettext "Updating trust database...")"