[pacman-dev] [PATCH] makepkg: allow passing arguments with spaces

Allan McRae allan at archlinux.org
Thu Oct 22 00:52:06 EDT 2009


Currently makepkg takes the commandline arguments, assigns them to a
variable and passes that variable to the next makepkg call (within
fakeroot).

Use a comination of quotes and arrays in this process to ensure any
arguments passed within quotes and containing spaces stay as a single
argument during the second makepkg call.

Thanks to Dan for figuring out how to get this working.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7e10eef..309211b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1496,7 +1496,7 @@ if [ ! $(type -t gettext) ]; then
 	}
 fi
 
-ARGLIST=$@
+ARGLIST=("$@")
 
 # Parse Command Line Options.
 OPT_SHORT="AcCdefFghiLmop:rRsV"
@@ -1916,9 +1916,9 @@ else
 		msg "$(gettext "Entering fakeroot environment...")"
 
 		if [ -n "$newpkgver" ]; then
-			fakeroot -- $0 --forcever $newpkgver -F $ARGLIST || exit $?
+			fakeroot -- $0 --forcever $newpkgver -F "${ARGLIST[@]}" || exit $?
 		else
-			fakeroot -- $0 -F $ARGLIST || exit $?
+			fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
 		fi
 	fi
 fi
-- 
1.6.5.1



More information about the pacman-dev mailing list