[pacman-dev] [PATCH 6/6] pacman-key: remake of --reload command

Allan McRae allan at archlinux.org
Thu Oct 7 00:34:13 EDT 2010


On 06/10/10 12:26, Denis A. Altoé Falqueto wrote:
> The --reload command was refactored to allow a more flexible management.
> There are two sets of keys that will be added, one that will be
> removed and one that will be kept.

<snip>

> Signed-off-by: Denis A. Altoé Falqueto<denisfalqueto at gmail.com>
> ---
>   scripts/pacman-key.sh.in |  152 +++++++++++++++++++++++++++++++++-------------
>   1 files changed, 110 insertions(+), 42 deletions(-)

Looks file to me overall.  A couple of comments/queries below:

<snip>

>
> +find_config() {
> +	# Prints on stdin the values of all the options from the configuration file that
> +	# are associated with the first parameter of this function.
> +	# The option names are stripped
> +	if (( $# == 0 )); then
> +		error "find_config: missing parameter"
> +		exit 1
> +	fi

Given this is only being called from within the script, I really do not 
think we need the error check there.

> +	grep -e "^[[:blank:]]*$1[[:blank:]]*=.*" "$CONFIG" | cut -d= -f 2-
> +}
> +

<snip>

> +
> +	# Read the key ids to an array. The conversion from whatever is inside the file
> +	# to key ids is important, because key ids are the only guarantee of identification
> +	# for the keys.
> +	local -A removed_ids
> +	if [[ -r "${REMOVED_KEYS}" ]]; then
> +		while read key; do
> +			local key_values name
> +			key_values=$(${GPG_PACMAN} --quiet --with-colons --list-key "${key}" | grep ^pub | cut -d: -f5,10 --output-delimiter=' ')
> +			if [[ -z $key_values ]]; then
> +				# The key is not in pacman's keyring, so search it on the added and deprecated keys

This I do not understand.  Surely if a key is in the remove list then it 
is not in the added or deprecated list.  I'd assume that if a key is to 
be removed and is not in the keyring already, then we have to do nothing.

Either that or if it could be added via the added and deprecated lists, 
deal with those first and just remove them all at the end.  I know it is 
a waste to add the key only to remove it later in that weird situation, 
but it would simplify this section of the code a lot.

Allan


More information about the pacman-dev mailing list