From ed7230d4486049fdd155ac6b86e07578d624aeb0 Mon Sep 17 00:00:00 2001 From: Thomas Deutschmann Date: Mon, 3 Sep 2018 16:37:33 +0200 Subject: [PATCH] dev-libs/openssl: fix race condition in install phase Closes: https://bugs.gentoo.org/665130 Package-Manager: Portage-2.3.48, Repoman-2.3.10 --- dev-libs/openssl/openssl-1.0.2p.ebuild | 18 ++++++++++++------ dev-libs/openssl/openssl-1.1.1_pre9.ebuild | 16 +++++++++++----- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/dev-libs/openssl/openssl-1.0.2p.ebuild b/dev-libs/openssl/openssl-1.0.2p.ebuild index 74788708e982..ddc45aa8700b 100644 --- a/dev-libs/openssl/openssl-1.0.2p.ebuild +++ b/dev-libs/openssl/openssl-1.0.2p.ebuild @@ -106,7 +106,7 @@ src_prepare() { -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \ -e $(has noman FEATURES \ && echo '/^install:/s:install_docs::' \ - || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \ + || echo '/^MANDIR=/s:=.*:='${EPREFIX%/}'/usr/share/man:') \ Makefile.org \ || die # show the actual commands in the log @@ -131,7 +131,7 @@ src_prepare() { append-flags $(test-flags-CC -Wa,--noexecstack) append-cppflags -DOPENSSL_NO_BUF_FREELISTS - sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906 + sed -i '1s,^:$,#!'${EPREFIX%/}'/usr/bin/perl,' Configure #141906 # The config script does stupid stuff to prompt the user. Kill it. sed -i '/stty -icanon min 0 time 50; read waste/d' config || die ./config --test-sanity || die "I AM NOT SANE" @@ -203,8 +203,8 @@ multilib_src_configure() { $(use_ssl sslv3 ssl3) \ $(use_ssl tls-heartbeat heartbeats) \ $(use_ssl zlib) \ - --prefix="${EPREFIX}"/usr \ - --openssldir="${EPREFIX}"${SSL_CNF_DIR} \ + --prefix="${EPREFIX%/}"/usr \ + --openssldir="${EPREFIX%/}"${SSL_CNF_DIR} \ --libdir=$(get_libdir) \ shared threads \ || die @@ -239,13 +239,19 @@ multilib_src_test() { } multilib_src_install() { - emake INSTALL_PREFIX="${D}" install + # We need to create $D/usr on our own to avoid a race condition #665130 + if [[ ! -d "${D%/}/usr" ]]; then + # We can only create this directory once + mkdir "${D%/}"/usr || die + fi + + emake INSTALL_PREFIX="${D%/}" install } multilib_src_install_all() { # openssl installs perl version of c_rehash by default, but # we provide a shell version via app-misc/c_rehash - rm "${ED}"/usr/bin/c_rehash || die + rm "${ED%/}"/usr/bin/c_rehash || die local -a DOCS=( CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el ) einstalldocs diff --git a/dev-libs/openssl/openssl-1.1.1_pre9.ebuild b/dev-libs/openssl/openssl-1.1.1_pre9.ebuild index e16b92f76ff6..e694ab91d167 100644 --- a/dev-libs/openssl/openssl-1.1.1_pre9.ebuild +++ b/dev-libs/openssl/openssl-1.1.1_pre9.ebuild @@ -58,7 +58,7 @@ src_prepare() { -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \ -e $(has noman FEATURES \ && echo '/^install:/s:install_docs::' \ - || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \ + || echo '/^MANDIR=/s:=.*:='${EPREFIX%/}'/usr/share/man:') \ -e "/^DOCDIR/s@\$(BASENAME)@&-${PF}@" \ Configurations/unix-Makefile.tmpl \ || die @@ -78,7 +78,7 @@ src_prepare() { # Prefixify Configure shebang (#141906) sed \ - -e "1s,/usr/bin/env,${EPREFIX}&," \ + -e "1s,/usr/bin/env,${EPREFIX%/}&," \ -i Configure || die # Remove test target when FEATURES=test isn't set if ! use test ; then @@ -150,8 +150,8 @@ multilib_src_configure() { $(use_ssl sctp) \ $(use_ssl tls-heartbeat heartbeats) \ $(use_ssl zlib) \ - --prefix="${EPREFIX}"/usr \ - --openssldir="${EPREFIX}"${SSL_CNF_DIR} \ + --prefix="${EPREFIX%/}"/usr \ + --openssldir="${EPREFIX%/}"${SSL_CNF_DIR} \ --libdir=$(get_libdir) \ shared threads \ || die @@ -185,7 +185,13 @@ multilib_src_test() { } multilib_src_install() { - emake DESTDIR="${D}" install + # We need to create $D/usr on our own to avoid a race condition #665130 + if [[ ! -d "${D%/}/usr" ]]; then + # We can only create this directory once + mkdir "${D%/}"/usr || die + fi + + emake DESTDIR="${D%}" install } multilib_src_install_all() { -- 2.26.2