[python3] 3.2.3-5: fix test_gdb.py (patch 156; rhbz#817072)

dmalcolm dmalcolm at fedoraproject.org
Tue May 1 15:41:55 UTC 2012


commit 938d1d78cefcedb5ccde5e6297a9fbbd5acdf6b3
Author: David Malcolm <dmalcolm at redhat.com>
Date:   Tue May 1 11:40:48 2012 -0400

    3.2.3-5: fix test_gdb.py (patch 156; rhbz#817072)
    
    * Mon Apr 30 2012 David Malcolm <dmalcolm at redhat.com> - 3.2.3-5
    - fix test_gdb.py (patch 156; rhbz#817072)

 00156-gdb-autoload-safepath.patch |   52 +++++++++++++++++++++++++++++++++++++
 python3.spec                      |   11 +++++++-
 2 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/00156-gdb-autoload-safepath.patch b/00156-gdb-autoload-safepath.patch
new file mode 100644
index 0000000..ac2aa40
--- /dev/null
+++ b/00156-gdb-autoload-safepath.patch
@@ -0,0 +1,52 @@
+diff -up Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath Python-3.2.3/Lib/test/test_gdb.py
+--- Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath	2012-04-30 17:16:24.092706954 -0400
++++ Python-3.2.3/Lib/test/test_gdb.py	2012-04-30 17:17:13.275703592 -0400
+@@ -46,6 +46,19 @@ def gdb_has_frame_select():
+ 
+ HAS_PYUP_PYDOWN = gdb_has_frame_select()
+ 
++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 b'"on" or "off" expected.' not in stderr
++    
++HAS_AUTOLOAD_SAFEPATH = gdb_has_autoload_safepath()
++
+ BREAKPOINT_FN='builtin_id'
+ 
+ class DebuggerTests(unittest.TestCase):
+@@ -106,15 +119,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/python3.spec b/python3.spec
index ff3b480..a31e752 100644
--- a/python3.spec
+++ b/python3.spec
@@ -122,7 +122,7 @@
 Summary: Version 3 of the Python programming language aka Python 3000
 Name: python3
 Version: %{pybasever}.3
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: Python
 Group: Development/Languages
 
@@ -394,6 +394,11 @@ Patch153: 00153-fix-test_gdb-noise.patch
 # embedding Python within httpd (rhbz#814391)
 Patch155: 00155-avoid-ctypes-thunks.patch
 
+# Recent builds of gdb will only auto-load scripts from certain safe
+# 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 ^^^)
 #
 # When adding new patches to "python" and "python3" in Fedora 17 onwards,
@@ -620,6 +625,7 @@ done
 %patch153 -p0
 # 00154: not for this branch
 %patch155 -p1
+%patch156 -p1
 
 # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
 # are many differences between 2.6 and the Python 3 library.
@@ -1442,6 +1448,9 @@ rm -fr %{buildroot}
 # ======================================================
 
 %changelog
+* Mon Apr 30 2012 David Malcolm <dmalcolm at redhat.com> - 3.2.3-5
+- fix test_gdb.py (patch 156; rhbz#817072)
+
 * Fri Apr 20 2012 David Malcolm <dmalcolm at redhat.com> - 3.2.3-4
 - avoid allocating thunks in ctypes unless absolutely necessary, to avoid
 generating SELinux denials on "import ctypes" and "import uuid" when embedding


More information about the scm-commits mailing list