pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/bootstrap
Module Name: pkgsrc
Committed By: rillig
Date: Wed May 1 18:29:20 UTC 2019
Modified Files:
pkgsrc/bootstrap: bootstrap
Log Message:
bootstrap: prevent pkgsrcdir, prefix and wrkdir from being symlinks
To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 pkgsrc/bootstrap/bootstrap
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/bootstrap/bootstrap
diff -u pkgsrc/bootstrap/bootstrap:1.262 pkgsrc/bootstrap/bootstrap:1.263
--- pkgsrc/bootstrap/bootstrap:1.262 Wed Apr 10 08:24:03 2019
+++ pkgsrc/bootstrap/bootstrap Wed May 1 18:29:20 2019
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: bootstrap,v 1.262 2019/04/10 08:24:03 adam Exp $
+# $NetBSD: bootstrap,v 1.263 2019/05/01 18:29:20 rillig Exp $
#
# Copyright (c) 2001-2011 Alistair Crooks <agc%NetBSD.org@localhost>
# All rights reserved.
@@ -344,17 +344,46 @@ get_optarg()
expr "x$1" : "x[^=]*=\\(.*\\)"
}
-checkarg_sane_absolute_path() {
+checkarg_sane_absolute_path()
+{
case "$1" in
"") ;; # the default value will be used.
*[!-A-Za-z0-9_./]*)
die "ERROR: Invalid characters in path $1 (from $2)." ;;
*/) die "ERROR: The argument to $2 must not end in /." ;;
- /*) ;;
+ *//* | */. | */./* | */.. | */../*)
+ die "ERROR: The path $1 (from $2) must be canonical." ;;
+ /*) checkarg_no_symlink_path "$1" "$2" ;;
*) die "ERROR: The argument to $2 must be an absolute path." ;;
esac
}
+checkarg_no_symlink_path()
+{
+ _dir=$1
+ while [ ! -d "$_dir" ]; do
+ _dir=${_dir%/*}
+ done
+
+ _realdir=`cd "$_dir" && exec pwd`
+ [ "$_realdir" = "$_dir" ] && return
+
+ die "ERROR: The path $1 (from $2) must not contain symlinks.
+
+ Given path : $1
+ Resolved path: $_realdir${1##${_dir}}
+
+ Several packages assume that the given path of $2 stays the same when
+ symlinks are resolved. When that assumption fails, they will:
+
+ * not find some include files or libraries during the build phase
+ since the files from dependencies are not installed in
+ \${WRKDIR}/.buildlink.
+
+ * install their files into the wrong path inside \${WRKDIR}/.destdir,
+ which will fail the PLIST check during the install phase."
+}
+
checkarg_sane_relative_path() {
case "$1" in
"") ;; # the default value will be used.
@@ -469,13 +498,13 @@ while [ $# -gt 0 ]; do
shift
done
-checkarg_sane_absolute_path "$wrkdir" "--workdir"
checkarg_sane_absolute_path "$prefix" "--prefix"
checkarg_sane_absolute_path "$pkgdbdir" "--pkgdbdir"
checkarg_sane_absolute_path "$sysconfdir" "--sysconfdir"
checkarg_sane_absolute_path "$varbase" "--varbase"
checkarg_sane_relative_path "$pkginfodir" "--pkginfodir"
checkarg_sane_relative_path "$pkgmandir" "--pkgmandir"
+checkarg_sane_absolute_path "$wrkdir" "--workdir"
# set defaults for system locations if not already set by the user
wrkobjdir=${wrkdir}/pkgsrc
Home |
Main Index |
Thread Index |
Old Index