From 793202344b47914d06a2c48bacbb6b232f7c5387 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 4 Jun 2018 09:31:19 -0400 Subject: makepkg: fix erroneous $BUILDDIR when $startdir is not an absolute path When comparing the $BUILDDIR to the $startdir, we used string equality instead of testing whether they are the same location, and ended up appending $pkgbase even though there's no reason to use it here. In some cases, this could result in makepkg erroring when trying to create $srcdir/$pkgdir, if a file with the same name as the $pkgbase exists. This is expected behavior if a file "src" or "pkg" exists, but decidedly less so for $pkgbase. This could be fixed either by setting $startdir to an absolute path, or by ensuring the test checks this directly; I've chosen to do both, since the test should really be correctly checking the thing it actually cares about, but since we ensure absolute paths are used everywhere else, this might bite us elsewhere someday. It's also more consistent. Fixes FS#58865 Signed-off-by: Eli Schwartz Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9918ee7e..32423262 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,7 +44,7 @@ unset GREP_OPTIONS declare -r makepkg_version='@PACKAGE_VERSION@' declare -r confdir='@sysconfdir@' declare -r BUILDSCRIPT='@BUILDSCRIPT@' -declare -r startdir="$PWD" +declare -r startdir="$(pwd -P)" LIBRARY=${LIBRARY:-'@libmakepkgdir@'} @@ -1453,7 +1453,7 @@ fi basever=$(get_full_version) -if [[ $BUILDDIR = "$startdir" ]]; then +if [[ $BUILDDIR -ef "$startdir" ]]; then srcdir="$BUILDDIR/src" pkgdirbase="$BUILDDIR/pkg" else -- cgit v1.2.3-54-g00ecf