[python] 2.7.3-6: try again to fix test_gdb.py (patch 156; rhbz#817072)
dmalcolm
dmalcolm at fedoraproject.org
Mon Apr 30 20:21:33 UTC 2012
commit 1fa9c84f237d8822d26b9b229a4d68eed5b667c3
Author: David Malcolm <dmalcolm at redhat.com>
Date: Mon Apr 30 16:20:26 2012 -0400
2.7.3-6: try again to fix test_gdb.py (patch 156; rhbz#817072)
* Mon Apr 30 2012 David Malcolm <dmalcolm at redhat.com> - 2.7.3-6
- try again to fix test_gdb.py (patch 156; rhbz#817072)
00156-gdb-autoload-safepath.patch | 56 ++++++++++++++++++++++++++++++------
python.spec | 9 ++++--
2 files changed, 52 insertions(+), 13 deletions(-)
---
diff --git a/00156-gdb-autoload-safepath.patch b/00156-gdb-autoload-safepath.patch
index 258c89d..54a5a6e 100644
--- a/00156-gdb-autoload-safepath.patch
+++ b/00156-gdb-autoload-safepath.patch
@@ -1,16 +1,52 @@
diff -up Python-2.7.3/Lib/test/test_gdb.py.gdb-autoload-safepath Python-2.7.3/Lib/test/test_gdb.py
---- Python-2.7.3/Lib/test/test_gdb.py.gdb-autoload-safepath 2012-04-30 12:55:43.372351709 -0400
-+++ Python-2.7.3/Lib/test/test_gdb.py 2012-04-30 12:58:24.355339144 -0400
-@@ -111,6 +111,12 @@ class DebuggerTests(unittest.TestCase):
- # Disable this:
- 'set print entry-values no',
+--- Python-2.7.3/Lib/test/test_gdb.py.gdb-autoload-safepath 2012-04-30 15:53:57.254045220 -0400
++++ Python-2.7.3/Lib/test/test_gdb.py 2012-04-30 16:19:19.569941124 -0400
+@@ -54,6 +54,19 @@ def gdb_has_frame_select():
+
+ HAS_PYUP_PYDOWN = gdb_has_frame_select()
-+ # Recent GDBs will only auto-load scripts from certain safe
-+ # locations.
-+ # Turn off this protection during the build to ensure that
-+ # our -gdb.py script can be loaded (rhbz#817072):
-+ 'set auto-load safe-path /',
++def gdb_has_autoload_safepath():
++ # Recent GDBs will only auto-load scripts from certain safe
++ # locations, so we will need to turn off this protection.
++ # However, if the GDB doesn't have it, then the following
++ # command will generate noise on stderr (rhbz#817072):
++ cmd = "--eval-command=set auto-load safe-path /"
++ p = subprocess.Popen(["gdb", "--batch", cmd],
++ stderr=subprocess.PIPE)
++ _, stderr = p.communicate()
++ return '"on" or "off" expected.' not in stderr
++
++HAS_AUTOLOAD_SAFEPATH = gdb_has_autoload_safepath()
+
+ class DebuggerTests(unittest.TestCase):
+
+ """Test that the debugger can debug Python."""
+@@ -112,15 +125,28 @@ class DebuggerTests(unittest.TestCase):
+ 'set print entry-values no',
+
'run']
++
++ if HAS_AUTOLOAD_SAFEPATH:
++ # Recent GDBs will only auto-load scripts from certain safe
++ # locations.
++ # Where necessary, turn off this protection to ensure that
++ # our -gdb.py script can be loaded - but not on earlier gdb builds
++ # as this would generate noise on stderr (rhbz#817072):
++ init_commands = ['set auto-load safe-path /']
++ else:
++ init_commands = []
++
if cmds_after_breakpoint:
commands += cmds_after_breakpoint
+ else:
+ commands += ['backtrace']
+
++ # print init_commands
+ # print commands
+
+ # Use "commands" to generate the arguments with which to invoke "gdb":
+ args = ["gdb", "--batch"]
++ args += ['--init-eval-command=%s' % cmd for cmd in init_commands]
+ args += ['--eval-command=%s' % cmd for cmd in commands]
+ args += ["--args",
+ sys.executable]
diff --git a/python.spec b/python.spec
index b5ae554..a18ad2f 100644
--- a/python.spec
+++ b/python.spec
@@ -108,7 +108,7 @@ Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python-docs when changing this:
Version: 2.7.3
-Release: 5%{?dist}
+Release: 6%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -624,8 +624,8 @@ Patch153: 00153-fix-test_gdb-noise.patch
Patch155: 00155-avoid-ctypes-thunks.patch
# Recent builds of gdb will only auto-load scripts from certain safe
-# locations. Turn off this protection during the build to ensure that our
-# -gdb.py script can be loaded when running test_gdb (rhbz#817072):
+# locations. Turn off this protection when running test_gdb in the selftest
+# suite to ensure that it can load our -gdb.py script (rhbz#817072):
Patch156: 00156-gdb-autoload-safepath.patch
# (New patches go here ^^^)
@@ -1779,6 +1779,9 @@ rm -fr %{buildroot}
# ======================================================
%changelog
+* Mon Apr 30 2012 David Malcolm <dmalcolm at redhat.com> - 2.7.3-6
+- try again to fix test_gdb.py (patch 156; rhbz#817072)
+
* Mon Apr 30 2012 David Malcolm <dmalcolm at redhat.com> - 2.7.3-5
- fix test_gdb.py (patch 156; rhbz#817072)
More information about the scm-commits
mailing list