[pacman-dev] [PATCH 5/7] pacman-key: fix quotation on several variable assignments
Allan McRae
allan at archlinux.org
Fri Jul 8 16:47:34 EDT 2011
On 08/07/11 22:56, Dave Reisner wrote:
>> @@ -264,7 +264,7 @@ if [[ ! -r "${CONFIG}" ]]; then
>> fi
>>
>> # Get GPGDIR from pacman.conf iff not specified on command line
>> -if [[ -z PACMAN_KEYRING_DIR&& GPGDIR=$(get_from "$CONFIG" "GPGDir") == 0 ]]; then
>> +if [[ -z PACMAN_KEYRING_DIR&& GPGDIR="$(get_from "$CONFIG" "GPGDir")" == 0 ]]; then
>
> This doesn't pertain to this patch, but I don't understand this logic.
> get_from should be writing the value of GPGDir as it's read from
> $CONFIG. It looks like the goal here was to make sure that get_from was
> successful, which would be written as:
>
> if [[ -z PACMAN_KEYRING_DIR ]]&& GPGDIR=$(get_from "$CONFIG" "GPGDir"); then
> PACMAN_KEYRING_DIR=$GPGDIR
> fi
> PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:- at sysconfdir@/pacman.d/gnupg}
>
> Or through a single default assignment to tidy the whole thing up:
>
> # if PACMAN_KEYRING_DIR isn't assigned, try to get it from the config
> # file, falling back on a hard default.
> : ${PACMAN_KEYRING_DIR:=$(get_from "$CONFIG" "GPGDir" || echo "@sysconfdir@/pacman.d/gnupg")}
>
> Will happily write up a patch if this is what was actually intended...
>
Send the patch.
The key is just to have the value is assigned in this priority:
1) --gpgdir value
2) $CONFIF value
3) default
Allan
More information about the pacman-dev
mailing list