From 3c58d002651cc16a546ffccdbb1f7ea0a5730abd Mon Sep 17 00:00:00 2001 From: "Gregory M. Tuner" Date: Mon, 14 Oct 2013 01:41:43 -0700 Subject: eclass/multibuild.eclass: multibuild_merge_root: Paranoia Check that target directories exist and if not, attempt to create them, being sure not to get mixed up by symlinks or non-directory, non-file filesystem entities. If the only file(s) installed by an ebuild are wrapped header files, the ebuild will crash without this patch. The problem is that ${ED}/usr/include does not exist; so when the eclass attempts to deploy, i.e., ${ED}/usr/include/foo.h the 'cp' invocation normally used to deploy that file will fail (stating correctly that ${ED}/usr/include does not exist) and muiltibuild_merge_root will consequently die. Signed-off-by: Gregory M. Tuner --- eclass/multibuild.eclass | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'eclass/multibuild.eclass') diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass index 0a2771e..4d402a4 100644 --- a/eclass/multibuild.eclass +++ b/eclass/multibuild.eclass @@ -257,6 +257,8 @@ multibuild_merge_root() { local lockfile_l=${lockfile}.${BASHPID} local ret + [[ ${dest} != /* ]] && die "Relative paths are not supported by multibuild_merge_root" + # Lock the install tree for merge. The touch+ln method ensures race # condition-free locking with maximum portability. touch "${lockfile_l}" || die @@ -265,6 +267,13 @@ multibuild_merge_root() { done rm "${lockfile_l}" || die + if [[ ! -d "${dest}" ]] ; then + dest=$(readlink -m "${dest}") + if [[ ! -d "${dest}" ]] ; then + [[ -e "${dest}" ]] && die "file \"${dest}\" already exists but is not a directory." + mkdir -p "${dest}" || die "couldn't create directory \"${dest}\"." + fi + fi if use userland_BSD; then # 'cp -a -n' is broken: # http://www.freebsd.org/cgi/query-pr.cgi?pr=174489 -- cgit v1.2.3-18-g5258