[pacman-dev] [PATCH] makepkg: deal with variable substitution when checking sanity
If any of pkgver, pkgrel or epoch contained a variable substitution, then it needed to be evaluated before checking its value conformed to the rules. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index e73fdfa..966caed 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1451,6 +1451,7 @@ check_sanity() { awk -F'=' '/^[[:space:]]*pkgver=/ { $1=""; print $0 }' "$BUILDFILE" | while read i _; do + eval i=$i if [[ $i =~ [[:space:]:-] ]]; then error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver" return 1 @@ -1459,6 +1460,7 @@ check_sanity() { awk -F'=' '/^[[:space:]]*pkgrel=/ { $1=""; print $0 }' "$BUILDFILE" | while read i _; do + eval i=$i if [[ $i =~ [[:space:]-] ]]; then error "$(gettext "%s is not allowed to contain hyphens or whitespace.")" "pkgrel" return 1 @@ -1467,6 +1469,7 @@ check_sanity() { awk -F'=' '/^[[:space:]]*epoch=/ { $1=""; print $0 }' "$BUILDFILE" | while read i _; do + eval i=$i if [[ ! $i =~ ^[0-9]*$ ]]; then error "$(gettext "%s must be an integer.")" "epoch" return 1 -- 1.7.6
On Thu, Aug 18, 2011 at 11:07:03PM +1000, Allan McRae wrote:
If any of pkgver, pkgrel or epoch contained a variable substitution, then it needed to be evaluated before checking its value conformed to the rules.
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index e73fdfa..966caed 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1451,6 +1451,7 @@ check_sanity() {
awk -F'=' '/^[[:space:]]*pkgver=/ { $1=""; print $0 }' "$BUILDFILE" | while read i _; do + eval i=$i
Quotes, please. This breaks on any whitespace in the value. eval i='$i'
if [[ $i =~ [[:space:]:-] ]]; then error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver" return 1 @@ -1459,6 +1460,7 @@ check_sanity() {
awk -F'=' '/^[[:space:]]*pkgrel=/ { $1=""; print $0 }' "$BUILDFILE" | while read i _; do + eval i=$i if [[ $i =~ [[:space:]-] ]]; then error "$(gettext "%s is not allowed to contain hyphens or whitespace.")" "pkgrel" return 1 @@ -1467,6 +1469,7 @@ check_sanity() {
awk -F'=' '/^[[:space:]]*epoch=/ { $1=""; print $0 }' "$BUILDFILE" | while read i _; do + eval i=$i if [[ ! $i =~ ^[0-9]*$ ]]; then error "$(gettext "%s must be an integer.")" "epoch" return 1 -- 1.7.6
participants (2)
-
Allan McRae
-
Dave Reisner