[pacman-dev] [PATCH] makepkg: canonicalize paths from environmental variables

Allan McRae allan at archlinux.org
Wed Sep 29 08:33:04 EDT 2010


This prevents circular symlinks and weird final package locations
when using commands like  'PKGDEST="." makepkg'.

Fixes FS#20922.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

Note that this adds readlink as a dependency to makepkg.  That is provided
by coreutils which is essential anyway so I do not think this is an issue.

 scripts/makepkg.sh.in |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 01d73f8..9c85d21 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1616,10 +1616,10 @@ while true; do
 	shift
 done
 
-#preserve environment variables
-_PKGDEST=${PKGDEST}
-_SRCDEST=${SRCDEST}
-_SRCPKGDEST=${SRCPKGDEST}
+# preserve environment variables and canonicalize path
+[[ -n ${PKGDEST} ]] && _PKGDEST=$(readlink -f ${PKGDEST})
+[[ -n ${SRCDEST} ]] && _SRCDEST=$(readlink -f ${SRCDEST})
+[[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(readlink -f ${SRCPKGDEST})
 
 # default config is makepkg.conf
 MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
-- 
1.7.3



More information about the pacman-dev mailing list