From bf351679373737f7b826b0840533b203eb15e4e4 Mon Sep 17 00:00:00 2001 From: Slavek Kabrda Date: Wed, 27 Nov 2013 13:03:43 +0100 Subject: [PATCH] Update to Python 3.4 beta 1. - Refreshed patches: 102 (lib64), 111 (no static lib), 125 (less verbose COUNT ALLOCS), 141 (fix COUNT_ALLOCS in test_module), 146 (hashlib fips), 157 (UID+GID overflows), 173 (ENOPROTOOPT in bind_port) - Removed patch 00187 (remove pthread atfork; upstreamed) --- ...n-3.3.0b1-lib64.patch => 00102-lib64.patch | 80 ++++++++-------- 00111-no-static-lib.patch | 2 +- 00125-less-verbose-COUNT_ALLOCS.patch | 4 +- 00141-fix-tests_with_COUNT_ALLOCS.patch | 4 +- 00146-hashlib-fips.patch | 84 +++++++---------- 00157-uid-gid-overflows.patch | 92 +++++++++---------- ...-workaround-ENOPROTOOPT-in-bind_port.patch | 13 ++- 00187-remove-pthread-atfork.patch | 89 ------------------ python3.spec | 17 +++- 9 files changed, 139 insertions(+), 246 deletions(-) rename python-3.3.0b1-lib64.patch => 00102-lib64.patch (70%) delete mode 100644 00187-remove-pthread-atfork.patch diff --git a/python-3.3.0b1-lib64.patch b/00102-lib64.patch similarity index 70% rename from python-3.3.0b1-lib64.patch rename to 00102-lib64.patch index afbdc6c..8f21624 100644 --- a/python-3.3.0b1-lib64.patch +++ b/00102-lib64.patch @@ -1,6 +1,5 @@ -diff -up cpython-59223da36dec/Lib/distutils/command/install.py.lib64 cpython-59223da36dec/Lib/distutils/command/install.py ---- cpython-59223da36dec/Lib/distutils/command/install.py.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/Lib/distutils/command/install.py 2012-08-07 16:41:00.573477549 -0400 +--- Python-3.4.0b1/Lib/distutils/command/install.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/distutils/command/install.py 2013-11-27 11:10:43.821150774 +0100 @@ -45,14 +45,14 @@ else: INSTALL_SCHEMES = { 'unix_prefix': { @@ -18,10 +17,9 @@ diff -up cpython-59223da36dec/Lib/distutils/command/install.py.lib64 cpython-592 'headers': '$base/include/python/$dist_name', 'scripts': '$base/bin', 'data' : '$base', -diff -up cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 cpython-59223da36dec/Lib/distutils/sysconfig.py ---- cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/Lib/distutils/sysconfig.py 2012-08-07 16:41:00.573477549 -0400 -@@ -139,8 +139,12 @@ def get_python_lib(plat_specific=0, stan +--- Python-3.4.0b1/Lib/distutils/sysconfig.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/distutils/sysconfig.py 2013-11-27 11:10:43.821150774 +0100 +@@ -141,8 +141,12 @@ prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": @@ -35,12 +33,11 @@ diff -up cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 cpython-59223da36 if standard_lib: return libpython else: -diff -up cpython-59223da36dec/Lib/site.py.lib64 cpython-59223da36dec/Lib/site.py ---- cpython-59223da36dec/Lib/site.py.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/Lib/site.py 2012-08-07 16:41:00.573477549 -0400 -@@ -303,12 +303,16 @@ def getsitepackages(prefixes=None): +--- Python-3.4.0b1/Lib/site.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/site.py 2013-11-27 11:10:43.822150773 +0100 +@@ -304,12 +304,16 @@ seen.add(prefix) - + if os.sep == '/': + sitepackages.append(os.path.join(prefix, "lib64", + "python" + sys.version[:3], @@ -55,10 +52,9 @@ diff -up cpython-59223da36dec/Lib/site.py.lib64 cpython-59223da36dec/Lib/site.py sitepackages.append(os.path.join(prefix, "lib", "site-packages")) if sys.platform == "darwin": # for framework builds *only* we add the standard Apple -diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sysconfig.py ---- cpython-59223da36dec/Lib/sysconfig.py.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/Lib/sysconfig.py 2012-08-07 16:41:00.574477549 -0400 -@@ -21,10 +21,10 @@ __all__ = [ +--- Python-3.4.0b1/Lib/sysconfig.py.lib64 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/sysconfig.py 2013-11-27 11:10:43.822150773 +0100 +@@ -20,10 +20,10 @@ _INSTALL_SCHEMES = { 'posix_prefix': { @@ -72,7 +68,7 @@ diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sy 'include': '{installed_base}/include/python{py_version_short}{abiflags}', 'platinclude': -@@ -81,10 +81,10 @@ _INSTALL_SCHEMES = { +@@ -61,10 +61,10 @@ 'data': '{userbase}', }, 'posix_user': { @@ -86,10 +82,9 @@ diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sy 'include': '{userbase}/include/python{py_version_short}', 'scripts': '{userbase}/bin', 'data': '{userbase}', -diff -up cpython-59223da36dec/Lib/test/test_site.py.lib64 cpython-59223da36dec/Lib/test/test_site.py ---- cpython-59223da36dec/Lib/test/test_site.py.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/Lib/test/test_site.py 2012-08-07 16:41:00.574477549 -0400 -@@ -239,12 +239,15 @@ class HelperFunctionsTests(unittest.Test +--- Python-3.4.0b1/Lib/test/test_site.py.lib64 2013-11-24 21:36:55.000000000 +0100 ++++ Python-3.4.0b1/Lib/test/test_site.py 2013-11-27 11:10:43.822150773 +0100 +@@ -244,12 +244,15 @@ self.assertEqual(dirs[2], wanted) elif os.sep == '/': # OS X non-framwework builds, Linux, FreeBSD, etc @@ -108,10 +103,9 @@ diff -up cpython-59223da36dec/Lib/test/test_site.py.lib64 cpython-59223da36dec/L else: # other platforms self.assertEqual(len(dirs), 2) -diff -up cpython-59223da36dec/Makefile.pre.in.lib64 cpython-59223da36dec/Makefile.pre.in ---- cpython-59223da36dec/Makefile.pre.in.lib64 2012-08-07 16:41:00.557477550 -0400 -+++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:41:00.575477549 -0400 -@@ -108,7 +108,7 @@ LIBDIR= @libdir@ +--- Python-3.4.0b1/Makefile.pre.in.lib64 2013-11-27 11:10:43.814150786 +0100 ++++ Python-3.4.0b1/Makefile.pre.in 2013-11-27 11:10:43.823150771 +0100 +@@ -115,7 +115,7 @@ MANDIR= @mandir@ INCLUDEDIR= @includedir@ CONFINCLUDEDIR= $(exec_prefix)/include @@ -120,9 +114,8 @@ diff -up cpython-59223da36dec/Makefile.pre.in.lib64 cpython-59223da36dec/Makefil ABIFLAGS= @ABIFLAGS@ # Detailed destination directories -diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modules/getpath.c ---- cpython-59223da36dec/Modules/getpath.c.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/Modules/getpath.c 2012-08-07 16:41:00.575477549 -0400 +--- Python-3.4.0b1/Modules/getpath.c.lib64 2013-11-24 21:36:56.000000000 +0100 ++++ Python-3.4.0b1/Modules/getpath.c 2013-11-27 11:17:33.619449704 +0100 @@ -122,8 +122,8 @@ #endif @@ -134,16 +127,16 @@ diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modul #endif #ifndef LANDMARK -@@ -135,7 +135,7 @@ static wchar_t exec_prefix[MAXPATHLEN+1] - static wchar_t progpath[MAXPATHLEN+1]; - static wchar_t *module_search_path = NULL; - static int module_search_path_malloced = 0; --static wchar_t *lib_python = L"lib/python" VERSION; -+static wchar_t *lib_python = L"lib64/python" VERSION; +@@ -498,7 +498,7 @@ + _pythonpath = _Py_char2wchar(PYTHONPATH, NULL); + _prefix = _Py_char2wchar(PREFIX, NULL); + _exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL); +- lib_python = _Py_char2wchar("lib/python" VERSION, NULL); ++ lib_python = _Py_char2wchar("lib/python64" VERSION, NULL); - static void - reduce(wchar_t *dir) -@@ -677,7 +677,7 @@ calculate_path(void) + if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) { + Py_FatalError( +@@ -687,7 +687,7 @@ } else wcsncpy(zip_path, _prefix, MAXPATHLEN); @@ -152,7 +145,7 @@ diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modul bufsz = wcslen(zip_path); /* Replace "00" with version */ zip_path[bufsz - 6] = VERSION[0]; zip_path[bufsz - 5] = VERSION[2]; -@@ -687,7 +687,7 @@ calculate_path(void) +@@ -699,7 +699,7 @@ fprintf(stderr, "Could not find platform dependent libraries \n"); wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN); @@ -161,10 +154,9 @@ diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modul } /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ -diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py ---- cpython-59223da36dec/setup.py.lib64 2012-08-07 06:10:57.000000000 -0400 -+++ cpython-59223da36dec/setup.py 2012-08-07 16:41:32.153475390 -0400 -@@ -438,7 +438,7 @@ class PyBuildExt(build_ext): +--- Python-3.4.0b1/setup.py.lib64 2013-11-24 21:36:56.000000000 +0100 ++++ Python-3.4.0b1/setup.py 2013-11-27 11:10:43.824150769 +0100 +@@ -441,7 +441,7 @@ # directories (i.e. '.' and 'Include') must be first. See issue # 10520. if not cross_compiling: @@ -173,7 +165,7 @@ diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') # only change this for cross builds for 3.3, issues on Mageia if cross_compiling: -@@ -708,11 +708,11 @@ class PyBuildExt(build_ext): +@@ -718,11 +718,11 @@ elif curses_library: readline_libs.append(curses_library) elif self.compiler.find_library_file(lib_dirs + @@ -187,7 +179,7 @@ diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py extra_link_args=readline_extra_link_args, libraries=readline_libs) ) else: -@@ -749,8 +749,8 @@ class PyBuildExt(build_ext): +@@ -759,8 +759,8 @@ if krb5_h: ssl_incs += krb5_h ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, diff --git a/00111-no-static-lib.patch b/00111-no-static-lib.patch index f74bc87..bd1bc40 100644 --- a/00111-no-static-lib.patch +++ b/00111-no-static-lib.patch @@ -2,7 +2,7 @@ diff -up cpython-59223da36dec/Makefile.pre.in.no-static-lib cpython-59223da36dec --- cpython-59223da36dec/Makefile.pre.in.no-static-lib 2012-08-07 16:43:43.296466422 -0400 +++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:44:13.299464371 -0400 @@ -464,7 +464,7 @@ coverage: - $(MAKE) coverage-lcov + $(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make # Build the interpreter -$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) diff --git a/00125-less-verbose-COUNT_ALLOCS.patch b/00125-less-verbose-COUNT_ALLOCS.patch index 8cef015..8e441a2 100644 --- a/00125-less-verbose-COUNT_ALLOCS.patch +++ b/00125-less-verbose-COUNT_ALLOCS.patch @@ -16,5 +16,5 @@ diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Pyth + if (Py_GETENV("PYTHONDUMPCOUNTS")) + dump_counts(stdout); #endif - - PRINT_TOTAL_REFS(); + /* dump hash stats */ + _PyHash_Fini(); diff --git a/00141-fix-tests_with_COUNT_ALLOCS.patch b/00141-fix-tests_with_COUNT_ALLOCS.patch index b60ee69..44be26e 100644 --- a/00141-fix-tests_with_COUNT_ALLOCS.patch +++ b/00141-fix-tests_with_COUNT_ALLOCS.patch @@ -60,8 +60,8 @@ diff -r e245b0d7209b Lib/test/test_module.py m = ModuleType("foo") wr = weakref.ref(m) @@ -190,6 +194,8 @@ - self.assertEqual(r[:25], "") + self.assertEqual(r[-len(ends_with):], ends_with, + '{!r} does not end with {!r}'.format(r, ends_with)) + @unittest.skipIf(hasattr(sys, 'getcounts'), + 'skipping since COUNT_ALLOCS was used, see issue19527') diff --git a/00146-hashlib-fips.patch b/00146-hashlib-fips.patch index 221ab50..f2cd3db 100644 --- a/00146-hashlib-fips.patch +++ b/00146-hashlib-fips.patch @@ -1,5 +1,5 @@ ---- Python-3.4.0a4/Lib/hashlib.py.hashlib-fips 2013-11-07 13:29:43.046881440 +0100 -+++ Python-3.4.0a4/Lib/hashlib.py 2013-11-07 13:42:04.438486289 +0100 +--- Python-3.4.0b1/Lib/hashlib.py.hashlib-fips 2013-11-24 21:36:54.000000000 +0100 ++++ Python-3.4.0b1/Lib/hashlib.py 2013-11-27 11:45:17.073617547 +0100 @@ -23,6 +23,16 @@ Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. @@ -17,27 +17,7 @@ Hash objects have these methods: - update(arg): Update the hash object with the bytes in arg. Repeated calls are equivalent to a single call with the concatenation of all -@@ -64,6 +74,19 @@ - 'algorithms_available', 'pbkdf2_hmac') - - -+import functools -+def __ignore_usedforsecurity(func): -+ """Used for sha3_* functions. Until OpenSSL implements them, we want -+ to use them from Python _sha3 module, but we want them to accept -+ usedforsecurity argument too.""" -+ # TODO: remove this function when OpenSSL implements sha3 -+ @functools.wraps(func) -+ def inner(*args, **kwargs): -+ if 'usedforsecurity' in kwargs: -+ kwargs.pop('usedforsecurity') -+ return func(*args, **kwargs) -+ return inner -+ - def __get_builtin_constructor(name): - try: - if name in ('SHA1', 'sha1'): -@@ -109,34 +132,41 @@ +@@ -108,34 +118,41 @@ f = getattr(_hashlib, 'openssl_' + name) # Allow the C module to raise ValueError. The function will be # defined but the hash not actually available thanks to OpenSSL. @@ -92,7 +72,7 @@ try: import _hashlib new = __hash_new -@@ -216,7 +246,10 @@ +@@ -215,7 +232,10 @@ # try them all, some may not work due to the OpenSSL # version not supporting that algorithm. try: @@ -104,13 +84,13 @@ except ValueError: import logging logging.exception('code for hash %s was not found.', __func_name) -@@ -224,3 +257,4 @@ +@@ -223,3 +243,4 @@ # Cleanup locals() del __always_supported, __func_name, __get_hash del __py_new, __hash_new, __get_openssl_constructor +del __ignore_usedforsecurity ---- Python-3.4.0a4/Lib/test/test_hashlib.py.hashlib-fips 2013-11-07 13:43:08.763454594 +0100 -+++ Python-3.4.0a4/Lib/test/test_hashlib.py 2013-11-07 13:55:23.233038101 +0100 +--- Python-3.4.0b1/Lib/test/test_hashlib.py.hashlib-fips 2013-11-24 21:36:55.000000000 +0100 ++++ Python-3.4.0b1/Lib/test/test_hashlib.py 2013-11-27 11:55:42.769601363 +0100 @@ -26,6 +26,20 @@ c_hashlib = import_fresh_module('hashlib', fresh=['_hashlib']) py_hashlib = import_fresh_module('hashlib', blocked=['_hashlib']) @@ -164,32 +144,37 @@ constructors.add(_test_algorithm_via_hashlib_new) _hashlib = self._conditional_import_module('_hashlib') -@@ -82,22 +106,9 @@ +@@ -82,27 +106,13 @@ for algorithm, constructors in self.constructors_to_test.items(): constructor = getattr(_hashlib, 'openssl_'+algorithm, None) if constructor: - constructors.add(constructor) + constructors.add(suppress_fips(constructor)) + def add_builtin_constructor(name): + constructor = getattr(hashlib, "__get_builtin_constructor")(name) + self.constructors_to_test[name].add(constructor) + - _md5 = self._conditional_import_module('_md5') - if _md5: -- self.constructors_to_test['md5'].add(_md5.md5) +- add_builtin_constructor('md5') - _sha1 = self._conditional_import_module('_sha1') - if _sha1: -- self.constructors_to_test['sha1'].add(_sha1.sha1) +- add_builtin_constructor('sha1') - _sha256 = self._conditional_import_module('_sha256') - if _sha256: -- self.constructors_to_test['sha224'].add(_sha256.sha224) -- self.constructors_to_test['sha256'].add(_sha256.sha256) +- add_builtin_constructor('sha224') +- add_builtin_constructor('sha256') - _sha512 = self._conditional_import_module('_sha512') - if _sha512: -- self.constructors_to_test['sha384'].add(_sha512.sha384) -- self.constructors_to_test['sha512'].add(_sha512.sha512) +- add_builtin_constructor('sha384') +- add_builtin_constructor('sha512') +- _sha3 = self._conditional_import_module('_sha3') + # TODO: remove this after sha3 is available through OpenSSL - _sha3 = self._conditional_import_module('_sha3') if _sha3: - self.constructors_to_test['sha3_224'].add(_sha3.sha3_224) -@@ -547,6 +558,65 @@ + add_builtin_constructor('sha3_224') + add_builtin_constructor('sha3_256') +@@ -558,6 +568,65 @@ self.assertEqual(expected_hash, hasher.hexdigest()) @@ -255,7 +240,7 @@ class KDFTests(unittest.TestCase): -@@ -628,6 +698,7 @@ +@@ -639,6 +708,7 @@ with self.assertRaisesRegex(ValueError, 'unsupported hash type'): pbkdf2('unknown', b'pass', b'salt', 1) @@ -263,8 +248,8 @@ def test_pbkdf2_hmac_py(self): self._test_pbkdf2_hmac(py_hashlib.pbkdf2_hmac) ---- Python-3.4.0a4/Modules/_hashopenssl.c.hashlib-fips 2013-11-07 13:55:47.466025086 +0100 -+++ Python-3.4.0a4/Modules/_hashopenssl.c 2013-11-07 14:14:32.745272791 +0100 +--- Python-3.4.0b1/Modules/_hashopenssl.c.hashlib-fips 2013-11-24 21:36:56.000000000 +0100 ++++ Python-3.4.0b1/Modules/_hashopenssl.c 2013-11-27 12:01:57.443537463 +0100 @@ -19,6 +19,8 @@ @@ -298,7 +283,7 @@ DEFINE_CONSTS_FOR_NEW(md5) DEFINE_CONSTS_FOR_NEW(sha1) -@@ -125,6 +135,48 @@ +@@ -97,6 +107,48 @@ } } @@ -347,7 +332,7 @@ /* Internal methods for a hash object */ static void -@@ -309,15 +361,16 @@ +@@ -281,15 +333,16 @@ static int EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds) { @@ -367,7 +352,7 @@ return -1; } -@@ -338,7 +391,12 @@ +@@ -310,7 +363,12 @@ PyBuffer_Release(&view); return -1; } @@ -381,7 +366,7 @@ self->name = name_obj; Py_INCREF(self->name); -@@ -422,7 +480,8 @@ +@@ -394,7 +452,8 @@ static PyObject * EVPnew(PyObject *name_obj, const EVP_MD *digest, const EVP_MD_CTX *initial_ctx, @@ -391,7 +376,7 @@ { EVPobject *self; -@@ -437,7 +495,12 @@ +@@ -409,7 +468,12 @@ if (initial_ctx) { EVP_MD_CTX_copy(&self->ctx, initial_ctx); } else { @@ -405,7 +390,7 @@ } if (cp && len) { -@@ -461,21 +524,29 @@ +@@ -433,21 +497,29 @@ An optional string argument may be provided and will be\n\ automatically hashed.\n\ \n\ @@ -439,7 +424,7 @@ return NULL; } -@@ -489,7 +560,8 @@ +@@ -461,7 +533,8 @@ digest = EVP_get_digestbyname(name); @@ -449,7 +434,7 @@ if (data_obj) PyBuffer_Release(&view); -@@ -744,57 +816,115 @@ +@@ -742,57 +815,115 @@ /* @@ -602,11 +587,12 @@ GEN_CONSTRUCTOR(md5) GEN_CONSTRUCTOR(sha1) -@@ -845,12 +974,10 @@ +@@ -843,13 +974,10 @@ { PyObject *m, *openssl_md_meth_names; - OpenSSL_add_all_digests(); +- ERR_load_crypto_strings(); + SSL_load_error_strings(); + SSL_library_init(); diff --git a/00157-uid-gid-overflows.patch b/00157-uid-gid-overflows.patch index bf82b60..43bd394 100644 --- a/00157-uid-gid-overflows.patch +++ b/00157-uid-gid-overflows.patch @@ -1,56 +1,54 @@ -diff -up Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_os.py ---- Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400 -+++ Python-3.3.0b1/Lib/test/test_os.py 2012-07-20 14:21:46.856688739 -0400 -@@ -1174,30 +1174,36 @@ if sys.platform != 'win32': - def test_setuid(self): - if os.getuid() != 0: - self.assertRaises(OSError, os.setuid, 0) -+ self.assertRaises(TypeError, os.setuid, 'not an int') - self.assertRaises(OverflowError, os.setuid, 1<<32) +--- Python-3.4.0b1/Lib/test/test_os.py.orig 2013-11-27 12:07:32.368411798 +0100 ++++ Python-3.4.0b1/Lib/test/test_os.py 2013-11-27 12:12:11.220265174 +0100 +@@ -1319,30 +1319,36 @@ + def test_setuid(self): + if os.getuid() != 0: + self.assertRaises(OSError, os.setuid, 0) ++ self.assertRaises(TypeError, os.setuid, 'not an int') + self.assertRaises(OverflowError, os.setuid, 1<<32) - if hasattr(os, 'setgid'): - def test_setgid(self): - if os.getuid() != 0 and not HAVE_WHEEL_GROUP: - self.assertRaises(OSError, os.setgid, 0) -+ self.assertRaises(TypeError, os.setgid, 'not an int') - self.assertRaises(OverflowError, os.setgid, 1<<32) + @unittest.skipUnless(hasattr(os, 'setgid'), 'test needs os.setgid()') + def test_setgid(self): + if os.getuid() != 0 and not HAVE_WHEEL_GROUP: + self.assertRaises(OSError, os.setgid, 0) ++ self.assertRaises(TypeError, os.setgid, 'not an int') + self.assertRaises(OverflowError, os.setgid, 1<<32) - if hasattr(os, 'seteuid'): - def test_seteuid(self): - if os.getuid() != 0: - self.assertRaises(OSError, os.seteuid, 0) -+ self.assertRaises(TypeError, os.seteuid, 'not an int') - self.assertRaises(OverflowError, os.seteuid, 1<<32) + @unittest.skipUnless(hasattr(os, 'seteuid'), 'test needs os.seteuid()') + def test_seteuid(self): + if os.getuid() != 0: + self.assertRaises(OSError, os.seteuid, 0) ++ self.assertRaises(TypeError, os.seteuid, 'not an int') + self.assertRaises(OverflowError, os.seteuid, 1<<32) - if hasattr(os, 'setegid'): - def test_setegid(self): - if os.getuid() != 0 and not HAVE_WHEEL_GROUP: - self.assertRaises(OSError, os.setegid, 0) -+ self.assertRaises(TypeError, os.setegid, 'not an int') - self.assertRaises(OverflowError, os.setegid, 1<<32) + @unittest.skipUnless(hasattr(os, 'setegid'), 'test needs os.setegid()') + def test_setegid(self): + if os.getuid() != 0 and not HAVE_WHEEL_GROUP: + self.assertRaises(OSError, os.setegid, 0) ++ self.assertRaises(TypeError, os.setegid, 'not an int') + self.assertRaises(OverflowError, os.setegid, 1<<32) - if hasattr(os, 'setreuid'): - def test_setreuid(self): - if os.getuid() != 0: - self.assertRaises(OSError, os.setreuid, 0, 0) -+ self.assertRaises(TypeError, os.setreuid, 'not an int', 0) -+ self.assertRaises(TypeError, os.setreuid, 0, 'not an int') - self.assertRaises(OverflowError, os.setreuid, 1<<32, 0) - self.assertRaises(OverflowError, os.setreuid, 0, 1<<32) + @unittest.skipUnless(hasattr(os, 'setreuid'), 'test needs os.setreuid()') + def test_setreuid(self): + if os.getuid() != 0: + self.assertRaises(OSError, os.setreuid, 0, 0) ++ self.assertRaises(TypeError, os.setreuid, 'not an int', 0) ++ self.assertRaises(TypeError, os.setreuid, 0, 'not an int') + self.assertRaises(OverflowError, os.setreuid, 1<<32, 0) + self.assertRaises(OverflowError, os.setreuid, 0, 1<<32) -@@ -1212,6 +1218,8 @@ if sys.platform != 'win32': - def test_setregid(self): - if os.getuid() != 0 and not HAVE_WHEEL_GROUP: - self.assertRaises(OSError, os.setregid, 0, 0) -+ self.assertRaises(TypeError, os.setregid, 'not an int', 0) -+ self.assertRaises(TypeError, os.setregid, 0, 'not an int') - self.assertRaises(OverflowError, os.setregid, 1<<32, 0) - self.assertRaises(OverflowError, os.setregid, 0, 1<<32) +@@ -1358,6 +1364,8 @@ + def test_setregid(self): + if os.getuid() != 0 and not HAVE_WHEEL_GROUP: + self.assertRaises(OSError, os.setregid, 0, 0) ++ self.assertRaises(TypeError, os.setregid, 'not an int', 0) ++ self.assertRaises(TypeError, os.setregid, 0, 'not an int') + self.assertRaises(OverflowError, os.setregid, 1<<32, 0) + self.assertRaises(OverflowError, os.setregid, 0, 1<<32) -diff -up Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_pwd.py ---- Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400 -+++ Python-3.3.0b1/Lib/test/test_pwd.py 2012-07-20 14:21:46.857688726 -0400 -@@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase): +--- Python-3.4.0b1/Lib/test/test_pwd.py.orig 2013-11-24 21:36:55.000000000 +0100 ++++ Python-3.4.0b1/Lib/test/test_pwd.py 2013-11-27 12:07:32.369411798 +0100 +@@ -89,9 +89,9 @@ # In some cases, byuids isn't a complete list of all users in the # system, so if we try to pick a value not in byuids (via a perturbing # loop, say), pwd.getpwuid() might still be able to find data for that diff --git a/00173-workaround-ENOPROTOOPT-in-bind_port.patch b/00173-workaround-ENOPROTOOPT-in-bind_port.patch index 498322c..8d8b0bc 100644 --- a/00173-workaround-ENOPROTOOPT-in-bind_port.patch +++ b/00173-workaround-ENOPROTOOPT-in-bind_port.patch @@ -1,13 +1,12 @@ -diff -up Python-3.3.0/Lib/test/support.py.rhbz913732 Python-3.3.0/Lib/test/support.py ---- Python-3.4.0a4/Lib/test/support/__init__.py.rhbz913732 2013-03-04 16:25:53.885258476 -0500 -+++ Python-3.4.0a4/Lib/test/support/__init__.py 2013-03-04 16:25:58.499258157 -0500 -@@ -544,7 +544,8 @@ def bind_port(sock, host=HOST): +--- Python-3.4.0b1/Lib/test/support/__init__.py.orig 2013-11-27 12:14:26.507216624 +0100 ++++ Python-3.4.0b1/Lib/test/support/__init__.py 2013-11-27 12:17:01.490805587 +0100 +@@ -593,7 +593,8 @@ if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1: raise TestFailed("tests should never set the SO_REUSEADDR " \ "socket option on TCP/IP sockets!") - if hasattr(socket, 'SO_REUSEPORT'): + if hasattr(socket, 'SO_REUSEPORT') \ + and 'WITHIN_PYTHON_RPM_BUILD' not in os.environ: # rhbz#913732 - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: - raise TestFailed("tests should never set the SO_REUSEPORT " \ - "socket option on TCP/IP sockets!") + try: + if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: + raise TestFailed("tests should never set the SO_REUSEPORT " \ diff --git a/00187-remove-pthread-atfork.patch b/00187-remove-pthread-atfork.patch deleted file mode 100644 index 04af52d..0000000 --- a/00187-remove-pthread-atfork.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff -r 6fdbb81b4020 -r 705f2addd0f0 Modules/_ssl.c ---- a/Modules/_ssl.c Tue Oct 29 12:14:55 2013 +0100 -+++ b/Modules/_ssl.c Tue Oct 29 21:11:55 2013 +0100 -@@ -19,9 +19,6 @@ - #ifdef WITH_THREAD - #include "pythread.h" - --#ifdef HAVE_PTHREAD_ATFORK --# include --#endif - - #define PySSL_BEGIN_ALLOW_THREADS_S(save) \ - do { if (_ssl_locks_count>0) { (save) = PyEval_SaveThread(); } } while (0) -@@ -2950,64 +2947,6 @@ - Returns number of bytes read. Raises SSLError if connection to EGD\n\ - fails or if it does not provide enough data to seed PRNG."); - --/* Seed OpenSSL's PRNG at fork(), http://bugs.python.org/issue18747 -- * -- * The parent handler seeds the PRNG from pseudo-random data like pid, the -- * current time (miliseconds or seconds) and an uninitialized array. -- * The array contains stack variables that are impossible to predict -- * on most systems, e.g. function return address (subject to ASLR), the -- * stack protection canary and automatic variables. -- * The code is inspired by Apache's ssl_rand_seed() function. -- * -- * Note: -- * The code uses pthread_atfork() until Python has a proper atfork API. The -- * handlers are not removed from the child process. A parent handler is used -- * instead of a child handler because fork() is supposed to be async-signal -- * safe but the handler calls unsafe functions. -- */ -- --#if defined(HAVE_PTHREAD_ATFORK) && defined(WITH_THREAD) --#define PYSSL_RAND_ATFORK 1 -- --static void --PySSL_RAND_atfork_parent(void) --{ -- struct { -- char stack[128]; /* uninitialized (!) stack data, 128 is an -- arbitrary number. */ -- pid_t pid; /* current pid */ -- _PyTime_timeval tp; /* current time */ -- } seed; -- --#ifdef WITH_VALGRIND -- VALGRIND_MAKE_MEM_DEFINED(seed.stack, sizeof(seed.stack)); --#endif -- seed.pid = getpid(); -- _PyTime_gettimeofday(&(seed.tp)); -- RAND_add((unsigned char *)&seed, sizeof(seed), 0.0); --} -- --static int --PySSL_RAND_atfork(void) --{ -- static int registered = 0; -- int retval; -- -- if (registered) -- return 0; -- -- retval = pthread_atfork(NULL, /* prepare */ -- PySSL_RAND_atfork_parent, /* parent */ -- NULL); /* child */ -- if (retval != 0) { -- PyErr_SetFromErrno(PyExc_OSError); -- return -1; -- } -- registered = 1; -- return 0; --} --#endif /* HAVE_PTHREAD_ATFORK */ -- - #endif /* HAVE_OPENSSL_RAND */ - - -@@ -3623,10 +3561,5 @@ - if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) - return NULL; - --#ifdef PYSSL_RAND_ATFORK -- if (PySSL_RAND_atfork() == -1) -- return NULL; --#endif -- - return m; - } diff --git a/python3.spec b/python3.spec index c7c5f66..1e61ab1 100644 --- a/python3.spec +++ b/python3.spec @@ -8,7 +8,7 @@ %global pyshortver 34 # prereleasetag -%global prerel a4 +%global prerel b1 %global pylibdir %{_libdir}/python%{pybasever} %global dynload_dir %{pylibdir}/lib-dynload @@ -240,7 +240,7 @@ Patch1: Python-3.1.1-rpath.patch # (where sys.getfilesystemencoding() == 'ascii') Patch55: 00055-systemtap.patch -Patch102: python-3.3.0b1-lib64.patch +Patch102: 00102-lib64.patch # 00104 # # Only used when "%{_lib}" == "lib64" @@ -611,8 +611,8 @@ Patch184: 00184-ctypes-should-build-with-libffi-multilib-wrapper.patch Patch186: 00186-dont-raise-from-py_compile.patch # 00187 # -# Temporarily add this upstream patch, should be in next upstream release -Patch187: 00187-remove-pthread-atfork.patch +# Fixed upstream as of Python 3.4.0b1 +# Patch187: 00187-remove-pthread-atfork.patch # 00188 # # Downstream only patch that should be removed when we compile all guaranteed @@ -889,7 +889,7 @@ done %patch184 -p1 # 00185 upstream as of Python 3.4.0a4 %patch186 -p1 -%patch187 -p1 +# 00187: upstream as of Python 3.4.0b1 %patch188 -p1 # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there @@ -1751,6 +1751,13 @@ rm -fr %{buildroot} # ====================================================== %changelog +* Mon Nov 25 2013 Bohuslav Kabrda - 3.4.0-0.1.b1 +- Update to Python 3.4 beta 1. +- Refreshed patches: 102 (lib64), 111 (no static lib), 125 (less verbose COUNT +ALLOCS), 141 (fix COUNT_ALLOCS in test_module), 146 (hashlib fips), +157 (UID+GID overflows), 173 (ENOPROTOOPT in bind_port) +- Removed patch 00187 (remove pthread atfork; upstreamed) + * Mon Nov 04 2013 Bohuslav Kabrda - 3.4.0-0.1.a4 - Update to Python 3.4 alpha 4. - Refreshed patches: 55 (systemtap), 102 (lib64), 111 (no static lib),