summaryrefslogtreecommitdiffstats
path: root/scripts/repo-add.sh.in
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-02-08 12:21:49 -0600
committerDan McGee <dan@archlinux.org>2009-02-15 21:16:21 -0600
commiteb1775e485f7320142a3c66332166ff5ab1f0401 (patch)
tree1db01534b6d40aed71140afbe522439e60d9f721 /scripts/repo-add.sh.in
parentea84819bbbdba90f950339790d482f2348c2e9ef (diff)
downloadpacman-eb1775e485f7320142a3c66332166ff5ab1f0401.tar.xz
repo-add: fix eval and quote issues
eval was ugly and dirty, and bit us here. Instead, use a safer form of variable declaration to ensure quotes don't foil us in pkgdesc or any other fields. This fixes FS#10837. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts/repo-add.sh.in')
-rw-r--r--scripts/repo-add.sh.in29
1 files changed, 16 insertions, 13 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index be0859ea..32e3a301 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -151,19 +151,22 @@ db_write_entry()
"
# read info from the zipped package
- local line
- for line in $(bsdtar -xOf "$pkgfile" .PKGINFO | \
- grep -v "^#" | sed 's|\(\w*\)\s*=\s*\(.*\)|\1="\2"|'); do
- eval "$line"
- case "$line" in
- group=*) _groups="$_groups$group\n" ;;
- depend=*) _depends="$_depends$depend\n" ;;
- backup=*) _backups="$_backups$backup\n" ;;
- license=*) _licenses="$_licenses$license\n" ;;
- replaces=*) _replaces="$_replaces$replaces\n" ;;
- provides=*) _provides="$_provides$provides\n" ;;
- conflict=*) _conflicts="$_conflicts$conflict\n" ;;
- optdepend=*) _optdepends="$_optdepends$optdepend\n" ;;
+ local line var val
+ for line in $(bsdtar -xOf "$pkgfile" .PKGINFO |
+ grep -v '^#' | sed 's|\(\w*\)\s*=\s*\(.*\)|\1 \2|'); do
+ # bash awesomeness here- var is always one word, val is everything else
+ var=${line%% *}
+ val=${line#* }
+ declare $var="$val"
+ case "$var" in
+ group) _groups="$_groups$group\n" ;;
+ depend) _depends="$_depends$depend\n" ;;
+ backup) _backups="$_backups$backup\n" ;;
+ license) _licenses="$_licenses$license\n" ;;
+ replaces) _replaces="$_replaces$replaces\n" ;;
+ provides) _provides="$_provides$provides\n" ;;
+ conflict) _conflicts="$_conflicts$conflict\n" ;;
+ optdepend) _optdepends="$_optdepends$optdepend\n" ;;
esac
done