[pacman-dev] [PATCH 1/2] pacman-key: fix syntax error in -r arg parsing

Dave Reisner d at falconindy.com
Tue Jul 19 17:59:55 EDT 2011


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 at 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



More information about the pacman-dev mailing list