pacman-key: ensure array iterations are quoted
When doing something like `pacman-key --edit-key 'Dan McGee'`, one would expect it to work, and not fail. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
765178c5ba
commit
4b6a5ae159
|
@ -203,7 +203,7 @@ verify_keyring_input() {
|
||||||
# Verify signatures of keyring files and association revocation files if they exist
|
# Verify signatures of keyring files and association revocation files if they exist
|
||||||
msg "$(gettext "Verifying keyring file signatures...")"
|
msg "$(gettext "Verifying keyring file signatures...")"
|
||||||
local keyring
|
local keyring
|
||||||
for keyring in ${KEYRINGIDS[@]}; do
|
for keyring in "${KEYRINGIDS[@]}"; do
|
||||||
if ! "${GPG_PACMAN[@]}" --verify "${KEYRING_IMPORT_DIR}/${keyring}.gpg.sig" &>/dev/null; then
|
if ! "${GPG_PACMAN[@]}" --verify "${KEYRING_IMPORT_DIR}/${keyring}.gpg.sig" &>/dev/null; then
|
||||||
error "$(gettext "The signature of file %s is not valid.")" "${ADDED_KEYS}"
|
error "$(gettext "The signature of file %s is not valid.")" "${ADDED_KEYS}"
|
||||||
ret=1
|
ret=1
|
||||||
|
@ -239,7 +239,7 @@ populate_keyring() {
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# verify listed keyrings exist
|
# verify listed keyrings exist
|
||||||
for keyring in ${KEYRINGIDS[@]}; do
|
for keyring in "${KEYRINGIDS[@]}"; do
|
||||||
if [[ ! -f "$KEYRING_IMPORT_DIR/$keyring.gpg" ]]; then
|
if [[ ! -f "$KEYRING_IMPORT_DIR/$keyring.gpg" ]]; then
|
||||||
error "$(gettext "The keyring file %s does not exist.")" "$KEYRING_IMPORT_DIR/$keyring.gpg"
|
error "$(gettext "The keyring file %s does not exist.")" "$KEYRING_IMPORT_DIR/$keyring.gpg"
|
||||||
ret=1
|
ret=1
|
||||||
|
@ -258,7 +258,7 @@ populate_keyring() {
|
||||||
local key_id
|
local key_id
|
||||||
|
|
||||||
# Add keys from requested keyrings
|
# Add keys from requested keyrings
|
||||||
for keyring in ${KEYRINGIDS[@]}; do
|
for keyring in "${KEYRINGIDS[@]}"; do
|
||||||
msg "$(gettext "Appending keys from %s.gpg...")" "$keyring"
|
msg "$(gettext "Appending keys from %s.gpg...")" "$keyring"
|
||||||
local add_keys="$("${GPG_NOKEYRING[@]}" --keyring "${KEYRING_IMPORT_DIR}/${keyring}.gpg" --with-colons --list-keys | grep ^pub | cut -d: -f5)"
|
local add_keys="$("${GPG_NOKEYRING[@]}" --keyring "${KEYRING_IMPORT_DIR}/${keyring}.gpg" --with-colons --list-keys | grep ^pub | cut -d: -f5)"
|
||||||
for key_id in ${add_keys}; do
|
for key_id in ${add_keys}; do
|
||||||
|
@ -270,7 +270,7 @@ populate_keyring() {
|
||||||
# to key ids is important, because key ids are the only guarantee of identification
|
# to key ids is important, because key ids are the only guarantee of identification
|
||||||
# for the keys.
|
# for the keys.
|
||||||
local -A removed_ids
|
local -A removed_ids
|
||||||
for keyring in ${KEYRINGIDS[@]}; do
|
for keyring in "${KEYRINGIDS[@]}"; do
|
||||||
if [[ -f "${KEYRING_IMPORT_DIR}/${keyring}-revoked" ]]; then
|
if [[ -f "${KEYRING_IMPORT_DIR}/${keyring}-revoked" ]]; then
|
||||||
while read key; do
|
while read key; do
|
||||||
local key_values name
|
local key_values name
|
||||||
|
@ -313,7 +313,7 @@ populate_keyring() {
|
||||||
|
|
||||||
edit_keys() {
|
edit_keys() {
|
||||||
local errors=0;
|
local errors=0;
|
||||||
for key in ${KEYIDS[@]}; do
|
for key in "${KEYIDS[@]}"; do
|
||||||
# Verify if the key exists in pacman's keyring
|
# Verify if the key exists in pacman's keyring
|
||||||
if ! "${GPG_PACMAN[@]}" --list-keys "$key" &>/dev/null; then
|
if ! "${GPG_PACMAN[@]}" --list-keys "$key" &>/dev/null; then
|
||||||
error "$(gettext "The key identified by %s does not exist")" "$key"
|
error "$(gettext "The key identified by %s does not exist")" "$key"
|
||||||
|
@ -322,7 +322,7 @@ edit_keys() {
|
||||||
done
|
done
|
||||||
(( errors )) && exit 1;
|
(( errors )) && exit 1;
|
||||||
|
|
||||||
for key in ${KEYIDS[@]}; do
|
for key in "${KEYIDS[@]}"; do
|
||||||
"${GPG_PACMAN[@]}" --edit-key "$key"
|
"${GPG_PACMAN[@]}" --edit-key "$key"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue