commit:     f4f1caaeb37825c01a2092d11bec4f932772bd38
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  2 09:37:19 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jul  2 16:30:59 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f4f1caae

econf: multijob-safe shebang tweaking

Using econf in parallel for multiple configurations (multilib, or
ncurses' wide+narrow), both may try to fix configure's shebang.
On Cygwin at least, this may cause 'sed -i' to fail with:
 sed: cannot rename /.../work/ncurses-6.0/sedXZsjI6: Permission denied
Instead of 'sed -i', better use 'mv -f' towards the original file.

 bin/phase-helpers.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index e1dcfd5e8..4b9b12b70 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -572,14 +572,14 @@ econf() {
        if [ -x "${ECONF_SOURCE}/configure" ]; then
                if [[ -n $CONFIG_SHELL && \
                        "$(head -n1 "$ECONF_SOURCE/configure")" =~ 
^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then
-                       # preserve timestamp, see bug #440304
-                       touch -r "${ECONF_SOURCE}/configure" 
"${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die
+                       cp -p "${ECONF_SOURCE}/configure" 
"${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die
                        sed -i \
                                -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" 
\
-                               "${ECONF_SOURCE}/configure" \
+                               
"${ECONF_SOURCE}/configure._portage_tmp_.${pid}" \
                                || die "Substition of shebang in 
'${ECONF_SOURCE}/configure' failed"
-                       touch -r 
"${ECONF_SOURCE}/configure._portage_tmp_.${pid}" "${ECONF_SOURCE}/configure" || 
die
-                       rm -f "${ECONF_SOURCE}/configure._portage_tmp_.${pid}"
+                       # preserve timestamp, see bug #440304
+                       touch -r "${ECONF_SOURCE}/configure" 
"${ECONF_SOURCE}/configure._portage_tmp_.${pid}" || die
+                       mv -f "${ECONF_SOURCE}/configure._portage_tmp_.${pid}" 
"${ECONF_SOURCE}/configure" || die
                fi
                if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then
                        find "${WORKDIR}" -type f '(' \

Reply via email to