[pacman-dev] [PATCH 1/2] pacman-key: fix syntax error in -r arg parsing
fixes: /usr/bin/pacman-key: line 437: ${1[0]}: bad substitution Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- Allan, I'm pretty sure this was your intention. Feel free to correct me if I'm wrong. scripts/pacman-key.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index cb108ac..b478b23 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -310,7 +310,7 @@ while true; do --gpgdir) shift; PACMAN_KEYRING_DIR=$1 ;; --init) INIT=1 ;; -l|--list) LIST=1 ;; - -r|--receive) RECEIVE=1; shift; KEYSERVER="${1[0]}"; KEYIDS=("${1[@]:1}") ;; + -r|--receive) RECEIVE=1; shift; KEYSERVER=$1; KEYIDS=("${@:1}") ;; --reload) RELOAD=1 ;; -u|--updatedb) UPDATEDB=1 ;; -v|--verify) VERIFY=1; shift; SIGNATURE=$1 ;; -- 1.7.6
fixes: /usr/bin/pacman-key: line 286: return: errors: numeric argument required Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/pacman-key.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index b478b23..6c3c471 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -159,7 +159,7 @@ verify_keyring_input() { fi fi - return errors + return $ret } reload_keyring() { -- 1.7.6
On 20/07/11 04:28, Dave Reisner wrote:
fixes: /usr/bin/pacman-key: line 437: ${1[0]}: bad substitution
Signed-off-by: Dave Reisner<dreisner@archlinux.org> --- Allan, I'm pretty sure this was your intention. Feel free to correct me if I'm wrong.
I really have no idea what my intention was there... but ack to your fix! Allan
On Wed, Jul 20, 2011 at 06:50:23AM +1000, Allan McRae wrote:
On 20/07/11 04:28, Dave Reisner wrote:
fixes: /usr/bin/pacman-key: line 437: ${1[0]}: bad substitution
Signed-off-by: Dave Reisner<dreisner@archlinux.org> --- Allan, I'm pretty sure this was your intention. Feel free to correct me if I'm wrong.
I really have no idea what my intention was there... but ack to your fix!
Allan
Well, discard this, I've got better ideas (among other reasons). If we can only specify one action at a time, why aren't we just taking advantage of the leftover positional parameters as arguments? In this particular case, suppose the following... pacman-key -r http://mykyserver.org key123 key456 key789 the URL is an OPTARG to -r/--retrieve and that's it. The remaining "$@" args are picked up in the retrieve function as the KEYIDS to fetch from the server. We show this pattern of --action "$OPTARG" "${KEYS[@]}" fairly consistenly in pacman-key so why not take advantage of it and get sane path handling (yay whitespace?) in the process. I'll throw together a patch when i get home. allan, just for you, i'll even test it. d
On 20/07/11 07:59, Dave Reisner wrote:
On Wed, Jul 20, 2011 at 06:50:23AM +1000, Allan McRae wrote:
On 20/07/11 04:28, Dave Reisner wrote:
fixes: /usr/bin/pacman-key: line 437: ${1[0]}: bad substitution
Signed-off-by: Dave Reisner<dreisner@archlinux.org> --- Allan, I'm pretty sure this was your intention. Feel free to correct me if I'm wrong.
I really have no idea what my intention was there... but ack to your fix!
Allan
Well, discard this, I've got better ideas (among other reasons). If we can only specify one action at a time,
In addition to --config and --gpgdir.... I really do not want to force those arguments to always be given first. How about: -r|--receive) RECEIVE=1; shift; TMP=($1); KEYSERVER=${TMP[0]}; KEYIDS=${TMP[@]:1}; unset TMP;; Allan
participants (2)
-
Allan McRae
-
Dave Reisner