mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 13:28:12 -05:00
makepkg: canonicalize paths from environmental variables
This prevents circular symlinks and weird final package locations when using commands like 'PKGDEST="." makepkg'. Fixes FS#20922. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
960c2cdcf7
commit
c0f58ea9a2
@ -1410,6 +1410,20 @@ run_split_packaging() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Canonicalize a directory path if it exists
|
||||||
|
canonicalize_path() {
|
||||||
|
local path="$1";
|
||||||
|
|
||||||
|
if [[ -d $path ]]; then
|
||||||
|
(
|
||||||
|
cd "$path"
|
||||||
|
pwd -P
|
||||||
|
)
|
||||||
|
else
|
||||||
|
echo "$path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# getopt like parser
|
# getopt like parser
|
||||||
parse_options() {
|
parse_options() {
|
||||||
local short_options=$1; shift;
|
local short_options=$1; shift;
|
||||||
@ -1615,10 +1629,10 @@ while true; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
#preserve environment variables
|
# preserve environment variables and canonicalize path
|
||||||
_PKGDEST=${PKGDEST}
|
[[ -n ${PKGDEST} ]] && _PKGDEST=$(canonicalize_path ${PKGDEST})
|
||||||
_SRCDEST=${SRCDEST}
|
[[ -n ${SRCDEST} ]] && _SRCDEST=$(canonicalize_path ${SRCDEST})
|
||||||
_SRCPKGDEST=${SRCPKGDEST}
|
[[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(canonicalize_path ${SRCPKGDEST})
|
||||||
|
|
||||||
# default config is makepkg.conf
|
# default config is makepkg.conf
|
||||||
MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
|
MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
|
||||||
|
Loading…
Reference in New Issue
Block a user