summaryrefslogtreecommitdiff
path: root/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue21166
blob: 54261f51da5ccb0843254f5f75bf304b5a7b33cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
--- /dev/null	2014-11-18 03:33:07.000000000 +0000
+++ build/pkgs/python/fbsd-patch-src_issue21166	2014-11-18 03:37:12.000000000 +0000
@@ -0,0 +1,74 @@
+# HG changeset patch
+# User Ned Deily <nad@acm.org>
+# Date 1408739459 25200
+# Node ID edb6b282469ea0e8f819d0310afb2937b59dd6b9
+# Parent  727fd4ead3fd854e900ed89362714ad1f7434e5a
+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.
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+--- src/Makefile.pre.in
++++ src/Makefile.pre.in
+@@ -447,8 +447,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
+--- src/Misc/NEWS
++++ src/Misc/NEWS
+@@ -120,6 +120,9 @@ Build
+ - Issue #15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/
+   now display special message when and only when there are failures.
+ 
++- Issue #21166: Prevent possible segfaults and other random failures of
++  python --generate-posix-vars in pybuilddir.txt build target.
++
+ Windows
+ -------
+ 
+diff --git a/configure b/configure
+--- src/configure
++++ src/configure
+@@ -2857,6 +2857,9 @@ case $host_os in *\ *) host_os=`echo "$h
+ 
+ 
+ 
++# 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
+--- src/configure.ac
++++ src/configure.ac
+@@ -16,6 +16,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
+