summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2014-08-22 20:32:49 (GMT)
committerNed Deily <nad@acm.org>2014-08-22 20:32:49 (GMT)
commitfcbc246e9f02cc780970defbcfa01767b7e3a3c6 (patch)
treeffd688ef004d7d04328ecbf1d7401df1effe22e7
parent0242f79051cd43343bafa797c2bfa9512f7be6c2 (diff)
downloadcpython-fcbc246e9f02cc780970defbcfa01767b7e3a3c6.zip
cpython-fcbc246e9f02cc780970defbcfa01767b7e3a3c6.tar.gz
cpython-fcbc246e9f02cc780970defbcfa01767b7e3a3c6.tar.bz2
Issue #21166: Prevent possible segfaults and other random failures of
python --generate-posix-vars in pybuilddir.txt build target by ensuring that pybuilddir.txt is always regenerated when configure is run and that the newly built skeleton python does not inadvertently import modules from previously installed instances.
-rw-r--r--Makefile.pre.in12
-rw-r--r--Misc/NEWS3
-rwxr-xr-xconfigure3
-rw-r--r--configure.ac3
4 files changed, 20 insertions, 1 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 3b4e21e..c0f0c7b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -546,8 +546,18 @@ platform: $(BUILDPYTHON) pybuilddir.txt
# Create build directory and generate the sysconfig build-time data there.
# pybuilddir.txt contains the name of the build dir and is used for
# sys.path fixup -- see Modules/getpath.c.
+# Since this step runs before shared modules are built, try to avoid bootstrap
+# problems by creating a dummy pybuildstr.txt just to allow interpreter
+# initialization to succeed. It will be overwritten by generate-posix-vars
+# or removed in case of failure.
pybuilddir.txt: $(BUILDPYTHON)
- $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
+ @echo "none" > ./pybuilddir.txt
+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
+ if test $$? -ne 0 ; then \
+ echo "generate-posix-vars failed" ; \
+ rm -f ./pybuilddir.txt ; \
+ exit 1 ; \
+ fi
# Build the shared modules
# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
diff --git a/Misc/NEWS b/Misc/NEWS
index 9396ac9..97d42db 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -242,6 +242,9 @@ Build
- Issue #21811: Anticipated fixes to support OS X versions > 10.9.
+- Issue #21166: Prevent possible segfaults and other random failures of
+ python --generate-posix-vars in pybuilddir.txt build target.
+
IDLE
----
diff --git a/configure b/configure
index 7379203..139d391 100755
--- a/configure
+++ b/configure
@@ -2950,6 +2950,9 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
+rm -f pybuilddir.txt
+
if test "$cross_compiling" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
$as_echo_n "checking for python interpreter for cross build... " >&6; }
diff --git a/configure.ac b/configure.ac
index 418e16f..9698ea0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,9 @@ AC_CANONICAL_HOST
AC_SUBST(build)
AC_SUBST(host)
+# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
+rm -f pybuilddir.txt
+
if test "$cross_compiling" = yes; then
AC_MSG_CHECKING([for python interpreter for cross build])
if test -z "$PYTHON_FOR_BUILD"; then