[pacman-dev] [PATCH 2/2] makepkg: normalize whitespace in $pkgdesc when writing .PKGINFO

Dave Reisner dreisner at archlinux.org
Sun Nov 25 16:07:46 EST 2012


Specifically, we shouldn't allow newlines in the pkgdesc field, as
pacman will ignore the continuation and end the description prematurely
as written to the local DB. Normalize ALL whitespace, replacing it with
single whitespace characters.

Fixes strange errors as seen by FS#32852.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
This seemed like the ideal place to fix it since we don't really care much
about the contents of pkgdesc anywhere else. I suppose its conceivable that
other fields might be interested in similar touching up.

 scripts/makepkg.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d387b7d..6b18233 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1653,7 +1653,7 @@ write_pkginfo() {
 	printf "pkgname = %s\n" "$1"
 	(( SPLITPKG )) && echo pkgbase = $pkgbase
 	echo "pkgver = $(get_full_version)"
-	printf "pkgdesc = %s\n" "$pkgdesc"
+	printf "pkgdesc = %s\n" "${pkgdesc//+([[:space:]])/ }"
 	printf "url = %s\n" "$url"
 	printf "builddate = %s\n" "$builddate"
 	printf "packager = %s\n" "$packager"
-- 
1.8.0



More information about the pacman-dev mailing list