20002606 bad runpaths in a few python binaries with studio 12.4
authorJohn Beck <John.Beck@Oracle.COM>
Tue, 11 Nov 2014 15:52:02 -0800
changeset 2213 b87f3edd5dd7
parent 2212 0b6092e8d4e7
child 2214 c98efe8be94e
20002606 bad runpaths in a few python binaries with studio 12.4
components/python/python26/patches/Python26-20-py_db.patch
components/python/python26/patches/Python26-25-studio-profile.patch
components/python/python26/python-26-tests.p5m
components/python/python27/patches/14-py_db.patch
components/python/python27/patches/20-bsddb-harmful.patch
components/python/python27/python-27-tests.p5m
components/python/python34/patches/12-py_db.patch
--- a/components/python/python26/patches/Python26-20-py_db.patch	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python26/patches/Python26-20-py_db.patch	Tue Nov 11 15:52:02 2014 -0800
@@ -1,7 +1,9 @@
-diff --git Python-2.6.4/Makefile.pre.in.orig Python-2.6.4/Makefile.pre.in
---- Python-2.6.4/Makefile.pre.in.orig	Sun Feb 13 19:37:16 2011
-+++ Python-2.6.4/Makefile.pre.in	Sun Feb 13 20:55:04 2011
-@@ -354,7 +354,7 @@
+This patch adds Python debugger support.  It may be contributed upstream at
+some point, but the suitability (or lack thereof) has not yet been determined.
+
+--- Python-2.6.8/Makefile.pre.in.~4~	2014-11-11 14:12:28.159605507 -0800
++++ Python-2.6.8/Makefile.pre.in	2014-11-11 14:12:28.295152443 -0800
+@@ -355,7 +355,7 @@
  
  # Default target
  all:		build_all
@@ -10,7 +12,7 @@
  
  # Compile a binary with gcc profile guided optimization.
  profile-opt:
-@@ -677,6 +677,20 @@
+@@ -678,6 +678,16 @@
  
  $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
  
@@ -19,19 +21,15 @@
 +libpython2.6_db.so.1.0:	$(srcdir)/py_db/libpython26_db.c
 +	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
 +
-+check_offset:	$(srcdir)/py_db/check_offsets.c
-+	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $<
++build-py_db:	libpython2.6_db.so.1.0
 +
-+build-py_db:	libpython2.6_db.so.1.0 check_offset
-+
-+install-py_db:	libpython2.6_db.so.1.0 check_offset
++install-py_db:	libpython2.6_db.so.1.0
 +	$(INSTALL_SHARED) libpython2.6_db.so.1.0 $(DESTDIR)$(LIBDIR)
-+	$(INSTALL_PROGRAM) check_offset $(DESTDIR)$(BINDIR)
 +
  install-pycc:	$(srcdir)/pycc
-        $(INSTALL_SCRIPT $< $(DESTDIR)$(BINLIBDEST)
-
-@@ -742,7 +755,7 @@
+ 	$(INSTALL_SCRIPT) $< $(DESTDIR)$(BINLIBDEST)
+ 
+@@ -743,7 +753,7 @@
  		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
  
  # Install everything
@@ -40,102 +38,6 @@
  
  # Install almost everything without disturbing previous versions
  altinstall:	@FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
-
-diff --git Python-2.6.4/py_db/check_offsets.c Python-2.6.4/py_db/check_offsets.c
-new file mode 100644
---- /dev/null
-+++ Python-2.6.4/py_db/check_offsets.c
-@@ -0,0 +1,88 @@
-+/*
-+ * CDDL HEADER START
-+ *
-+ * The contents of this file are subject to the terms of the
-+ * Common Development and Distribution License (the "License").
-+ * You may not use this file except in compliance with the License.
-+ *
-+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+ * or http://www.opensolaris.org/os/licensing.
-+ * See the License for the specific language governing permissions
-+ * and limitations under the License.
-+ *
-+ * When distributing Covered Code, include this CDDL HEADER in each
-+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+ * If applicable, add the following below this CDDL HEADER, with the
-+ * fields enclosed by brackets "[]" replaced with your own identifying
-+ * information: Portions Copyright [yyyy] [name of copyright owner]
-+ *
-+ * CDDL HEADER END
-+ */
-+/*
-+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
-+ * Use is subject to license terms.
-+ */
-+
-+#include <stdio.h>
-+
-+#include <Python.h>
-+#include <frameobject.h>
-+
-+#include "libpython26_db_32.h"
-+
-+#if 0
-+#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
-+#endif
-+
-+int
-+main(void)
-+{
-+/*
-+ * PyCodeObject co_name
-+ * PyCodeObject co_filename
-+ * PyCodeObject co_lnotab
-+ * PyFrameObject f_back
-+ * PyFrameObject f_code
-+ * PyFrameObject f_lasti
-+ * PyInterpreterState next
-+ * PyInterpreterState tstate_head
-+ * PyStringObject ob_sval
-+ * PyStringObject ob_size
-+ * PyThreadState frame
-+ * PyThreadState next
-+ */
-+
-+	printf("struct member: native 32\n");
-+	printf("PyCodeObject co_name: %d %d\n", offsetof(PyCodeObject, co_name),
-+	    offsetof(PyCodeObject32, co_name));
-+	printf("PyCodeObject co_filename: %d %d\n", offsetof(PyCodeObject,
-+	    co_filename), offsetof(PyCodeObject32, co_filename));
-+	printf("PyCodeObject co_lnotab: %d %d\n", offsetof(PyCodeObject,
-+	    co_lnotab), offsetof(PyCodeObject32, co_lnotab));
-+	printf("PyFrameObject f_back: %d %d\n", offsetof(PyFrameObject, f_back),
-+	    offsetof(PyFrameObject32, f_back));
-+	printf("PyFrameObject f_code: %d %d\n", offsetof(PyFrameObject, f_code),
-+	    offsetof(PyFrameObject32, f_code));
-+	printf("PyFrameObject f_lasti: %d %d\n", offsetof(PyFrameObject,
-+	    f_lasti), offsetof(PyFrameObject32, f_lasti));
-+	printf("PyInterpreterState next: %d %d\n", offsetof(PyInterpreterState,
-+	    next), offsetof(PyInterpreterState32, next));
-+	printf("PyInterpreterState tstate_head: %d %d\n",
-+	    offsetof(PyInterpreterState, tstate_head),
-+	    offsetof(PyInterpreterState32, tstate_head));
-+	printf("PyStringObject ob_sval: %d %d\n", offsetof(PyStringObject,
-+	    ob_sval), offsetof(PyStringObject32, ob_sval));
-+	printf("PyStringObject ob_size: %d %d\n", offsetof(PyStringObject,
-+	    ob_size), offsetof(PyStringObject32, ob_size));
-+	printf("PyThreadState frame: %d %d\n", offsetof(PyThreadState, frame),
-+	    offsetof(PyThreadState32, frame));
-+	printf("PyThreadState next: %d %d\n", offsetof(PyThreadState, next),
-+	    offsetof(PyThreadState32, next));
-+
-+	printf("\nObject sizes\n");
-+	printf("PyObject: %d %d\n", sizeof (PyObject), sizeof (PyObject32));
-+	printf("PyVarObject: %d %d\n", sizeof (PyVarObject),
-+	    sizeof (PyVarObject32));
-+
-+	return (0);
-+}
-diff --git Python-2.6.4/py_db/libpython26_db.c Python-2.6.4/py_db/libpython26_db.c
-new file mode 100644
 --- /dev/null
 +++ Python-2.6.4/py_db/libpython26_db.c
 @@ -0,0 +1,655 @@
--- a/components/python/python26/patches/Python26-25-studio-profile.patch	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python26/patches/Python26-25-studio-profile.patch	Tue Nov 11 15:52:02 2014 -0800
@@ -59,7 +59,7 @@
  
  # Build static library
  # avoid long command lines, same as LIBRARY_OBJS
-@@ -1170,6 +1176,7 @@
+@@ -1166,6 +1172,7 @@
  clean: pycremoval
  	find . -name '*.[oa]' -exec rm -f {} ';'
  	find . -name '*.s[ol]' -exec rm -f {} ';'
@@ -67,7 +67,7 @@
  	find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
  	find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
  	find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
-@@ -1177,6 +1184,7 @@
+@@ -1173,6 +1180,7 @@
  
  profile-removal:
  	find . -name '*.gc??' -exec rm -f {} ';'
--- a/components/python/python26/python-26-tests.p5m	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python26/python-26-tests.p5m	Tue Nov 11 15:52:02 2014 -0800
@@ -257,10 +257,6 @@
 file path=usr/lib/python2.6/test/badsyntax_nocaret.py pkg.tmp.autopyc=false
 file path=usr/lib/python2.6/test/buffer_tests.py
 file path=usr/lib/python2.6/test/cfgparser.1
-file usr/bin/check_offset \
-    path=usr/lib/python2.6/test/check_offset mode=0555
-file usr/bin/$(MACH64)/check_offset \
-    path=usr/lib/python2.6/test/check_offset64 mode=0555
 file path=usr/lib/python2.6/test/check_soundcard.vbs
 file path=usr/lib/python2.6/test/cjkencodings_test.py
 file path=usr/lib/python2.6/test/cmath_testcases.txt
--- a/components/python/python27/patches/14-py_db.patch	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python27/patches/14-py_db.patch	Tue Nov 11 15:52:02 2014 -0800
@@ -12,7 +12,7 @@
  
  # Compile a binary with gcc profile guided optimization.
  profile-opt:
-@@ -778,6 +778,19 @@
+@@ -778,6 +778,15 @@
  
  $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
  
@@ -21,18 +21,14 @@
 +libpython2.7_db.so.1.0:        $(srcdir)/py_db/libpython27_db.c
 +	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
 +
-+check_offset:  $(srcdir)/py_db/check_offsets.c
-+	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $<
++build-py_db:   libpython2.7_db.so.1.0
 +
-+build-py_db:   libpython2.7_db.so.1.0 check_offset
-+
-+install-py_db: libpython2.7_db.so.1.0 check_offset
++install-py_db: libpython2.7_db.so.1.0
 +	$(INSTALL_SHARED) libpython2.7_db.so.1.0 $(DESTDIR)$(LIBDIR)
-+	$(INSTALL_PROGRAM) check_offset $(DESTDIR)$(BINDIR)
  
  ######################################################################
  
-@@ -842,7 +855,7 @@
+@@ -842,7 +851,7 @@
  		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
  
  # Install everything
@@ -42,98 +38,6 @@
  # Install almost everything without disturbing previous versions
  altinstall:	@FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall \
 --- /dev/null
-+++ Python-2.7.1/py_db/check_offsets.c
-@@ -0,0 +1,87 @@
-+/*
-+ * CDDL HEADER START
-+ *
-+ * The contents of this file are subject to the terms of the
-+ * Common Development and Distribution License (the "License").
-+ * You may not use this file except in compliance with the License.
-+ *
-+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+ * or http://www.opensolaris.org/os/licensing.
-+ * See the License for the specific language governing permissions
-+ * and limitations under the License.
-+ *
-+ * When distributing Covered Code, include this CDDL HEADER in each
-+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+ * If applicable, add the following below this CDDL HEADER, with the
-+ * fields enclosed by brackets "[]" replaced with your own identifying
-+ * information: Portions Copyright [yyyy] [name of copyright owner]
-+ *
-+ * CDDL HEADER END
-+ */
-+/*
-+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
-+
-+#include <stdio.h>
-+
-+#include <Python.h>
-+#include <frameobject.h>
-+
-+#include "libpython27_db_32.h"
-+
-+#if 0
-+#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
-+#endif
-+
-+int
-+main(void)
-+{
-+/*
-+ * PyCodeObject co_name
-+ * PyCodeObject co_filename
-+ * PyCodeObject co_lnotab
-+ * PyFrameObject f_back
-+ * PyFrameObject f_code
-+ * PyFrameObject f_lasti
-+ * PyInterpreterState next
-+ * PyInterpreterState tstate_head
-+ * PyStringObject ob_sval
-+ * PyStringObject ob_size
-+ * PyThreadState frame
-+ * PyThreadState next
-+ */
-+
-+	printf("struct member: native 32\n");
-+	printf("PyCodeObject co_name: %d %d\n", offsetof(PyCodeObject, co_name),
-+	    offsetof(PyCodeObject32, co_name));
-+	printf("PyCodeObject co_filename: %d %d\n", offsetof(PyCodeObject,
-+	    co_filename), offsetof(PyCodeObject32, co_filename));
-+	printf("PyCodeObject co_lnotab: %d %d\n", offsetof(PyCodeObject,
-+	    co_lnotab), offsetof(PyCodeObject32, co_lnotab));
-+	printf("PyFrameObject f_back: %d %d\n", offsetof(PyFrameObject, f_back),
-+	    offsetof(PyFrameObject32, f_back));
-+	printf("PyFrameObject f_code: %d %d\n", offsetof(PyFrameObject, f_code),
-+	    offsetof(PyFrameObject32, f_code));
-+	printf("PyFrameObject f_lasti: %d %d\n", offsetof(PyFrameObject,
-+	    f_lasti), offsetof(PyFrameObject32, f_lasti));
-+	printf("PyInterpreterState next: %d %d\n", offsetof(PyInterpreterState,
-+	    next), offsetof(PyInterpreterState32, next));
-+	printf("PyInterpreterState tstate_head: %d %d\n",
-+	    offsetof(PyInterpreterState, tstate_head),
-+	    offsetof(PyInterpreterState32, tstate_head));
-+	printf("PyStringObject ob_sval: %d %d\n", offsetof(PyStringObject,
-+	    ob_sval), offsetof(PyStringObject32, ob_sval));
-+	printf("PyStringObject ob_size: %d %d\n", offsetof(PyStringObject,
-+	    ob_size), offsetof(PyStringObject32, ob_size));
-+	printf("PyThreadState frame: %d %d\n", offsetof(PyThreadState, frame),
-+	    offsetof(PyThreadState32, frame));
-+	printf("PyThreadState next: %d %d\n", offsetof(PyThreadState, next),
-+	    offsetof(PyThreadState32, next));
-+
-+	printf("\nObject sizes\n");
-+	printf("PyObject: %d %d\n", sizeof (PyObject), sizeof (PyObject32));
-+	printf("PyVarObject: %d %d\n", sizeof (PyVarObject),
-+	    sizeof (PyVarObject32));
-+
-+	return (0);
-+}
-diff --git Python-2.7.1/py_db/libpython27_db.c Python-2.7.1/py_db/libpython27_db.c
-new file mode 100644
---- /dev/null
 +++ Python-2.7.1/py_db/libpython27_db.c
 @@ -0,0 +1,654 @@
 +/*
--- a/components/python/python27/patches/20-bsddb-harmful.patch	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python27/patches/20-bsddb-harmful.patch	Tue Nov 11 15:52:02 2014 -0800
@@ -5,7 +5,7 @@
 
 --- Python-2.7.7/Makefile.pre.in.~4~	2014-06-02 11:08:40.909703116 -0700
 +++ Python-2.7.7/Makefile.pre.in	2014-06-02 11:08:40.977964319 -0700
-@@ -975,7 +975,7 @@
+@@ -971,7 +971,7 @@
  		email email/mime email/test email/test/data \
  		json json/tests \
  		sqlite3 sqlite3/test \
--- a/components/python/python27/python-27-tests.p5m	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python27/python-27-tests.p5m	Tue Nov 11 15:52:02 2014 -0800
@@ -329,9 +329,6 @@
 file path=usr/lib/python2.7/test/badsyntax_nocaret.py
 file path=usr/lib/python2.7/test/buffer_tests.py
 file path=usr/lib/python2.7/test/cfgparser.1
-file usr/bin/check_offset path=usr/lib/python2.7/test/check_offset mode=0555
-file usr/bin/$(MACH64)/check_offset path=usr/lib/python2.7/test/check_offset64 \
-    mode=0555
 file path=usr/lib/python2.7/test/check_soundcard.vbs
 file path=usr/lib/python2.7/test/cjkencodings/big5-utf8.txt
 file path=usr/lib/python2.7/test/cjkencodings/big5.txt
--- a/components/python/python34/patches/12-py_db.patch	Mon Nov 17 15:12:43 2014 -0800
+++ b/components/python/python34/patches/12-py_db.patch	Tue Nov 11 15:52:02 2014 -0800
@@ -12,7 +12,7 @@
  
  # Compile a binary with gcc profile guided optimization.
  profile-opt:
-@@ -673,6 +673,19 @@
+@@ -673,6 +673,15 @@
  	@mv config.c Modules
  	@echo "The Makefile was updated, you may need to re-run make."
  
@@ -21,18 +21,14 @@
 +libpython$(LDVERSION)_db.so.1.0:        $(srcdir)/py_db/libpython34_db.c
 +	$(CC) -o $@ $(CFLAGS) $(PY_CPPFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
 +
-+check_offset:  $(srcdir)/py_db/check_offsets.c
-+	$(CC) -o $@ $(CFLAGS) $(PY_CPPFLAGS) $(CPPFLAGS) $<
++build-py_db:   libpython$(LDVERSION)_db.so.1.0
 +
-+build-py_db:   libpython$(LDVERSION)_db.so.1.0 check_offset
-+
-+install-py_db: libpython$(LDVERSION)_db.so.1.0 check_offset
++install-py_db: libpython$(LDVERSION)_db.so.1.0
 +	$(INSTALL_SHARED) libpython$(LDVERSION)_db.so.1.0 $(DESTDIR)$(LIBDIR)
-+	$(INSTALL_PROGRAM) check_offset $(DESTDIR)$(BINDIR)
  
  Modules/Setup: $(srcdir)/Modules/Setup.dist
  	@if test -f Modules/Setup; then \
-@@ -1042,7 +1055,7 @@
+@@ -1042,7 +1051,7 @@
  		$(TESTRUNNER) $(QUICKTESTOPTS)
  
  
@@ -42,96 +38,6 @@
  		case $(ENSUREPIP) in \
  			upgrade) ensurepip="--upgrade" ;; \
 --- /dev/null
-+++ Python-3.4.0/py_db/check_offsets.c
-@@ -0,0 +1,87 @@
-+/*
-+ * CDDL HEADER START
-+ *
-+ * The contents of this file are subject to the terms of the
-+ * Common Development and Distribution License (the "License").
-+ * You may not use this file except in compliance with the License.
-+ *
-+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-+ * or http://www.opensolaris.org/os/licensing.
-+ * See the License for the specific language governing permissions
-+ * and limitations under the License.
-+ *
-+ * When distributing Covered Code, include this CDDL HEADER in each
-+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-+ * If applicable, add the following below this CDDL HEADER, with the
-+ * fields enclosed by brackets "[]" replaced with your own identifying
-+ * information: Portions Copyright [yyyy] [name of copyright owner]
-+ *
-+ * CDDL HEADER END
-+ */
-+/*
-+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-+ */
-+
-+#include <stdio.h>
-+
-+#include <Python.h>
-+#include <frameobject.h>
-+
-+#include "libpython34_db_32.h"
-+
-+#if 0
-+#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
-+#endif
-+
-+int
-+main(void)
-+{
-+/*
-+ * PyCodeObject co_name
-+ * PyCodeObject co_filename
-+ * PyCodeObject co_lnotab
-+ * PyFrameObject f_back
-+ * PyFrameObject f_code
-+ * PyFrameObject f_lasti
-+ * PyInterpreterState next
-+ * PyInterpreterState tstate_head
-+ * PyBytesObject ob_sval
-+ * PyBytesObject ob_size
-+ * PyThreadState frame
-+ * PyThreadState next
-+ */
-+
-+	printf("struct member: native 32\n");
-+	printf("PyCodeObject co_name: %d %d\n", offsetof(PyCodeObject, co_name),
-+	    offsetof(PyCodeObject32, co_name));
-+	printf("PyCodeObject co_filename: %d %d\n", offsetof(PyCodeObject,
-+	    co_filename), offsetof(PyCodeObject32, co_filename));
-+	printf("PyCodeObject co_lnotab: %d %d\n", offsetof(PyCodeObject,
-+	    co_lnotab), offsetof(PyCodeObject32, co_lnotab));
-+	printf("PyFrameObject f_back: %d %d\n", offsetof(PyFrameObject, f_back),
-+	    offsetof(PyFrameObject32, f_back));
-+	printf("PyFrameObject f_code: %d %d\n", offsetof(PyFrameObject, f_code),
-+	    offsetof(PyFrameObject32, f_code));
-+	printf("PyFrameObject f_lasti: %d %d\n", offsetof(PyFrameObject,
-+	    f_lasti), offsetof(PyFrameObject32, f_lasti));
-+	printf("PyInterpreterState next: %d %d\n", offsetof(PyInterpreterState,
-+	    next), offsetof(PyInterpreterState32, next));
-+	printf("PyInterpreterState tstate_head: %d %d\n",
-+	    offsetof(PyInterpreterState, tstate_head),
-+	    offsetof(PyInterpreterState32, tstate_head));
-+	printf("PyBytesObject ob_sval: %d %d\n", offsetof(PyBytesObject,
-+	    ob_sval), offsetof(PyBytesObject32, ob_sval));
-+	printf("PyBytesObject ob_size: %d %d\n", offsetof(PyBytesObject,
-+	    ob_base.ob_size), offsetof(PyBytesObject32, ob_size));
-+	printf("PyThreadState frame: %d %d\n", offsetof(PyThreadState, frame),
-+	    offsetof(PyThreadState32, frame));
-+	printf("PyThreadState next: %d %d\n", offsetof(PyThreadState, next),
-+	    offsetof(PyThreadState32, next));
-+
-+	printf("\nObject sizes\n");
-+	printf("PyObject: %d %d\n", sizeof (PyObject), sizeof (PyObject32));
-+	printf("PyVarObject: %d %d\n", sizeof (PyVarObject),
-+	    sizeof (PyVarObject32));
-+
-+	return (0);
-+}
---- /dev/null
 +++ Python-3.4.0/py_db/libpython34_db.c
 @@ -0,0 +1,654 @@
 +/*