Add python3 package

This commit is contained in:
Alexpux
2013-11-05 11:00:07 +04:00
parent aeb48e10a5
commit 364da82498
23 changed files with 2539 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
--- Python-3.3.2-orig/Modules/main.c 2013-05-15 20:32:59.000000000 +0400
+++ Python-3.3.2/Modules/main.c 2013-08-02 00:00:38.549804600 +0400
@@ -14,9 +14,11 @@
#include <windows.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+#ifndef PATH_MAX
#define PATH_MAX MAXPATHLEN
#endif
#endif
+#endif
#ifdef _MSC_VER
#include <crtdbg.h>

View File

@@ -0,0 +1,12 @@
--- Python-3.3.2-orig/Lib/ctypes/__init__.py 2013-08-02 00:29:33.877929600 +0400
+++ Python-3.3.2/Lib/ctypes/__init__.py 2013-05-15 20:32:54.000000000 +0400
@@ -436,7 +436,8 @@
if _os.name in ("nt", "ce"):
pythonapi = PyDLL("python dll", None, _sys.dllhandle)
elif _sys.platform == "cygwin":
- pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
+ pythonapi = PyDLL("libpython%d.%d%s.dll" % \
+ (_sys.version_info[:2] + tuple(_sys.abiflags)))
else:
pythonapi = PyDLL(None)

View File

@@ -0,0 +1,39 @@
--- Python-3.3.2-orig/Lib/ctypes/util.py 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Lib/ctypes/util.py 2013-08-01 23:57:43.715820300 +0400
@@ -83,6 +83,25 @@
continue
return None
+elif sys.platform == "cygwin":
+ def find_library(name):
+ for libdir in ['/usr/lib', '/usr/local/lib']:
+ for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]:
+ implib = os.path.join(libdir, libext)
+ if not os.path.exists(implib):
+ continue
+ cmd = "dlltool -I " + implib + " 2>/dev/null"
+ f = os.popen(cmd)
+ try:
+ data = f.read()
+ finally:
+ f.close()
+ res = data.replace("\n","")
+ if not res:
+ continue
+ return res
+ return None
+
elif os.name == "posix":
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
import re, tempfile, errno
@@ -256,6 +275,10 @@
print(cdll.LoadLibrary("libcrypto.dylib"))
print(cdll.LoadLibrary("libSystem.dylib"))
print(cdll.LoadLibrary("System.framework/System"))
+ elif sys.platform == "cygwin":
+ print(cdll.LoadLibrary("cygbz2-1.dll"))
+ print(find_library("crypt"))
+ print(cdll.LoadLibrary("cygcrypt-0.dll"))
else:
print(cdll.LoadLibrary("libm.so"))
print(cdll.LoadLibrary("libcrypt.so"))

View File

@@ -0,0 +1,46 @@
--- Python-3.3.2-orig/Lib/distutils/command/build_ext.py 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Lib/distutils/command/build_ext.py 2013-08-02 00:15:05.345703100 +0400
@@ -730,9 +730,9 @@
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
elif sys.platform[:6] == "cygwin":
- template = "python%d.%d"
+ template = "python%d.%d%s"
pythonlib = (template %
- (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
+ (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, sys.abiflags))
# don't extend ext.libraries, it may be shared with other
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
--- Python-3.3.2-orig/Modules/makesetup 2013-05-15 20:32:59.000000000 +0400
+++ Python-3.3.2/Modules/makesetup 2013-08-02 00:17:46.703125000 +0400
@@ -91,7 +91,7 @@
else
ExtraLibDir='$(LIBPL)'
fi
- ExtraLibs="-L$ExtraLibDir -lpython\$(VERSION)";;
+ ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";;
esac
# Main loop
--- Python-3.3.2-orig/configure.ac 2013-05-15 20:33:00.000000000 +0400
+++ Python-3.3.2/configure.ac 2013-08-02 00:18:22.859375000 +0400
@@ -921,6 +921,7 @@
case $ac_sys_system in
CYGWIN*)
LDLIBRARY='libpython$(LDVERSION).dll.a'
+ BLDLIBRARY='-L. -lpython$(LDVERSION)'
DLLLIBRARY='libpython$(LDVERSION).dll'
;;
SunOS*)
--- Python-3.3.2-orig/Makefile.pre.in 2013-05-15 20:32:57.000000000 +0400
+++ Python-3.3.2/Makefile.pre.in 2013-08-02 00:16:23.352539000 +0400
@@ -560,7 +560,7 @@
# This rule builds the Cygwin Python DLL and import library if configured
# for a shared core library; otherwise, this rule is a noop.
-$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
+$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
if test -n "$(DLLLIBRARY)"; then \
$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \

27
python3/3.3-dbm.patch Normal file
View File

@@ -0,0 +1,27 @@
--- Python-3.3.2-orig/setup.py 2013-05-15 20:33:00.000000000 +0400
+++ Python-3.3.2/setup.py 2013-08-01 23:45:32.806640600 +0400
@@ -1137,7 +1137,7 @@
dbm_setup_debug = False # verbose debug prints from this script?
dbm_order = ['gdbm']
# The standard Unix dbm module:
- if host_platform not in ['cygwin']:
+ if host_platform not in ['win32']:
config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args
@@ -1192,6 +1192,15 @@
],
libraries = gdbm_libs)
break
+ if find_file("ndbm.h", inc_dirs, []) is not None:
+ print("building dbm using gdbm")
+ dbmext = Extension(
+ '_dbm', ['_dbmmodule.c'],
+ define_macros=[
+ ('HAVE_NDBM_H', None),
+ ],
+ libraries = gdbm_libs)
+ break
elif cand == "bdb":
if db_incs is not None:
if dbm_setup_debug: print("building dbm using bdb")

View File

@@ -0,0 +1,23 @@
--- Python-3.3.2-orig/Lib/distutils/cygwinccompiler.py 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Lib/distutils/cygwinccompiler.py 2013-08-02 00:24:11.022460900 +0400
@@ -91,9 +91,7 @@
compiler_type = 'cygwin'
obj_extension = ".o"
static_lib_extension = ".a"
- shared_lib_extension = ".dll"
- static_lib_format = "lib%s%s"
- shared_lib_format = "%s%s"
+ shared_lib_extension = ".dll.a"
exe_extension = ".exe"
def __init__(self, verbose=0, dry_run=0, force=0):
--- Python-3.3.2-orig/Lib/distutils/unixccompiler.py 2013-08-01 23:49:16.568359300 +0400
+++ Python-3.3.2/Lib/distutils/unixccompiler.py 2013-08-02 00:25:54.459960900 +0400
@@ -79,6 +79,7 @@
static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
if sys.platform == "cygwin":
exe_extension = ".exe"
+ dylib_lib_extension = ".dll.a"
def preprocess(self, source, output_file=None, macros=None,
include_dirs=None, extra_preargs=None, extra_postargs=None):

View File

@@ -0,0 +1,11 @@
--- Python-3.3.2-orig/Lib/distutils/unixccompiler.py 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Lib/distutils/unixccompiler.py 2013-08-01 23:49:16.568359300 +0400
@@ -222,7 +222,7 @@
# the configuration data stored in the Python installation, so
# we use this hack.
compiler = os.path.basename(sysconfig.get_config_var("CC"))
- if sys.platform[:6] == "darwin":
+ if sys.platform[:6] == "darwin" or sys.platform[:6] == "cygwin":
# MacOSX's linker doesn't understand the -R flag at all
return "-L" + dir
elif sys.platform[:5] == "hp-ux":

View File

@@ -0,0 +1,11 @@
--- Python-3.3.2-orig/Include/node.h 2013-05-15 20:32:53.000000000 +0400
+++ Python-3.3.2/Include/node.h 2013-08-02 00:11:53.044921800 +0400
@@ -21,7 +21,7 @@
char *str, int lineno, int col_offset);
PyAPI_FUNC(void) PyNode_Free(node *n);
#ifndef Py_LIMITED_API
-Py_ssize_t _PyNode_SizeOf(node *n);
+PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
#endif
/* Node access functions */

View File

@@ -0,0 +1,11 @@
--- Python-3.3.2-orig/Include/pyerrors.h 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Include/pyerrors.h 2013-08-02 00:09:05.202148400 +0400
@@ -290,7 +290,7 @@
/* In signalmodule.c */
#ifndef Py_LIMITED_API
-int PySignal_SetWakeupFd(int fd);
+PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
#endif
/* Support for adding program text to SyntaxErrors */

View File

@@ -0,0 +1,18 @@
--- Python-3.3.2-orig/Include/pyport.h 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Include/pyport.h 2013-08-02 11:50:31.637695300 +0400
@@ -760,7 +760,15 @@
/* http://docs.python.org/extending/windows.html#a-cookbook-approach */
# if !defined(__CYGWIN__)
# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
+# else
+# define PyAPI_FUNC(RTYPE) RTYPE
# endif /* !__CYGWIN__ */
+ /* NOTE: The issue3945 "compile error in _fileio.c (cygwin)"
+ * was resolved with modification of code.
+ * This issue was resolved for gcc(mingw) with enabling auto
+ * import feature. Since _fileio.c problem now disappear there
+ * is no more reasons to avoid dllimport for gcc(mingw).
+ */
# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
/* module init functions outside the core must be exported */
# if defined(__cplusplus)

View File

@@ -0,0 +1,15 @@
--- Python-3.3.2-orig/Modules/_sqlite/connection.c 2013-05-15 20:32:58.000000000 +0400
+++ Python-3.3.2/Modules/_sqlite/connection.c 2013-08-02 00:49:59.884765600 +0400
@@ -712,9 +712,12 @@
}
error:
+ {
#ifdef WITH_THREAD
PyGILState_Release(threadstate);
#endif
+ ;
+ }
}
static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self)

View File

@@ -0,0 +1,16 @@
--- Python-3.3.2-orig/Include/py_curses.h 2013-05-15 20:32:53.000000000 +0400
+++ Python-3.3.2/Include/py_curses.h 2013-08-02 00:05:13.842773400 +0400
@@ -17,6 +17,13 @@
#define NCURSES_OPAQUE 0
#endif /* __APPLE__ */
+#ifdef __CYGWIN__
+/* the following define is necessary for Cygwin; without it, the
+ Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
+ can't get at the WINDOW flags field. */
+#define NCURSES_INTERNALS
+#endif /* __CYGWIN__ */
+
#ifdef __FreeBSD__
/*
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards

21
python3/3.3-pep3149.patch Normal file
View File

@@ -0,0 +1,21 @@
--- Python-3.3.2-orig/configure.ac 2013-08-02 00:18:22.859375000 +0400
+++ Python-3.3.2/configure.ac 2013-08-02 00:35:10.071289000 +0400
@@ -3945,7 +3945,7 @@
AC_SUBST(EXT_SUFFIX)
case $ac_sys_system in
- Linux*|GNU*)
+ Linux*|GNU*|CYGWIN*)
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
*)
EXT_SUFFIX=${SHLIB_SUFFIX};;
--- Python-3.3.2-orig/Python/dynload_shlib.c 2013-05-15 20:33:00.000000000 +0400
+++ Python-3.3.2/Python/dynload_shlib.c 2013-08-02 00:38:38.291015600 +0400
@@ -38,6 +38,7 @@
const char *_PyImport_DynLoadFiletab[] = {
#ifdef __CYGWIN__
+ "." SOABI ".dll",
".dll",
#else /* !__CYGWIN__ */
#if defined(PYOS_OS2) && defined(PYCC_GCC)

View File

@@ -0,0 +1,13 @@
--- Python-3.3.2-orig/Modules/_ssl.c 2013-05-15 20:32:58.000000000 +0400
+++ Python-3.3.2/Modules/_ssl.c 2013-08-02 00:03:01.190429600 +0400
@@ -16,6 +16,10 @@
#include "Python.h"
+#ifdef __CYGWIN__
+#undef WITH_THREAD
+#endif
+
#ifdef WITH_THREAD
#include "pythread.h"
#define PySSL_BEGIN_ALLOW_THREADS_S(save) \

View File

@@ -0,0 +1,73 @@
--- Python-3.3.2-orig/Include/pythread.h 2013-05-15 20:32:54.000000000 +0400
+++ Python-3.3.2/Include/pythread.h 2013-08-02 00:44:41.784179600 +0400
@@ -77,11 +77,11 @@
PyAPI_FUNC(PyObject*) PyThread_GetInfo(void);
/* Thread Local Storage (TLS) API */
-PyAPI_FUNC(int) PyThread_create_key(void);
-PyAPI_FUNC(void) PyThread_delete_key(int);
-PyAPI_FUNC(int) PyThread_set_key_value(int, void *);
-PyAPI_FUNC(void *) PyThread_get_key_value(int);
-PyAPI_FUNC(void) PyThread_delete_key_value(int key);
+PyAPI_FUNC(long) PyThread_create_key(void);
+PyAPI_FUNC(void) PyThread_delete_key(long);
+PyAPI_FUNC(int) PyThread_set_key_value(long, void *);
+PyAPI_FUNC(void *) PyThread_get_key_value(long);
+PyAPI_FUNC(void) PyThread_delete_key_value(long key);
/* Cleanup after a fork */
PyAPI_FUNC(void) PyThread_ReInitTLS(void);
--- Python-3.3.2-orig/Python/pystate.c 2013-05-15 20:33:00.000000000 +0400
+++ Python-3.3.2/Python/pystate.c 2013-08-02 00:46:14.940429600 +0400
@@ -37,7 +37,7 @@
GILState implementation
*/
static PyInterpreterState *autoInterpreterState = NULL;
-static int autoTLSkey = 0;
+static long autoTLSkey = 0;
#else
#define HEAD_INIT() /* Nothing */
#define HEAD_LOCK() /* Nothing */
--- Python-3.3.2-orig/Python/thread_pthread.h 2013-05-15 20:33:00.000000000 +0400
+++ Python-3.3.2/Python/thread_pthread.h 2013-08-02 00:47:54.674804600 +0400
@@ -600,7 +600,7 @@
#define Py_HAVE_NATIVE_TLS
-int
+long
PyThread_create_key(void)
{
pthread_key_t key;
@@ -609,19 +609,19 @@
}
void
-PyThread_delete_key(int key)
+PyThread_delete_key(long key)
{
pthread_key_delete(key);
}
void
-PyThread_delete_key_value(int key)
+PyThread_delete_key_value(long key)
{
pthread_setspecific(key, NULL);
}
int
-PyThread_set_key_value(int key, void *value)
+PyThread_set_key_value(long key, void *value)
{
int fail;
void *oldValue = pthread_getspecific(key);
@@ -632,7 +632,7 @@
}
void *
-PyThread_get_key_value(int key)
+PyThread_get_key_value(long key)
{
return pthread_getspecific(key);
}

27
python3/3.3-tkinter.patch Normal file
View File

@@ -0,0 +1,27 @@
--- Python-3.3.2-orig/setup.py 2013-08-01 23:45:32.806640600 +0400
+++ Python-3.3.2/setup.py 2013-08-01 23:54:03.430664000 +0400
@@ -1696,12 +1696,6 @@
include_dirs.append('/usr/X11/include')
added_lib_dirs.append('/usr/X11/lib')
- # If Cygwin, then verify that X is installed before proceeding
- if host_platform == 'cygwin':
- x11_inc = find_file('X11/Xlib.h', [], include_dirs)
- if x11_inc is None:
- return
-
# Check for BLT extension
if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
'BLT8.0'):
@@ -1719,9 +1713,8 @@
if host_platform in ['aix3', 'aix4']:
libs.append('ld')
- # Finally, link with the X11 libraries (not appropriate on cygwin)
- if host_platform != "cygwin":
- libs.append('X11')
+ # Finally, link with the X11 libraries
+ libs.append('X11')
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
define_macros=[('WITH_APPINIT', 1)] + defs,

View File

@@ -0,0 +1,129 @@
--- Python-3.3.2/Modules/getpath.c.orig 2013-05-15 20:32:59.000000000 +0400
+++ Python-3.3.2/Modules/getpath.c 2013-10-21 20:41:43.579800000 +0400
@@ -10,6 +10,10 @@
#include <mach-o/dyld.h>
#endif
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+#include <windows.h>
+#endif
+
/* Search in some common locations for the associated Python libraries.
*
* Two directories must be found, the platform independent directory
@@ -132,7 +136,11 @@
static wchar_t prefix[MAXPATHLEN+1];
static wchar_t exec_prefix[MAXPATHLEN+1];
-static wchar_t progpath[MAXPATHLEN+1];
+static wchar_t progpath[MAXPATHLEN+1] = {'\0'};
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+static wchar_t dllpath[MAXPATHLEN+1] = {'\0'};
+extern HANDLE PyWin_DLLhModule;
+#endif
static wchar_t *module_search_path = NULL;
static int module_search_path_malloced = 0;
static wchar_t *lib_python = L"lib/python" VERSION;
@@ -213,7 +221,11 @@
joinpath(wchar_t *buffer, wchar_t *stuff)
{
size_t n, k;
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+ if (stuff[0] == SEP || (wcslen(stuff)>=2 && stuff[0] != 0 && stuff[1] == ':'))
+#else
if (stuff[0] == SEP)
+#endif
n = 0;
else {
n = wcslen(buffer);
@@ -227,6 +239,13 @@
k = MAXPATHLEN - n;
wcsncpy(buffer+n, stuff, k);
buffer[n+k] = '\0';
+#if defined(__CYGWIN__)
+ /* MSYS specific: Turn C:* into /c* */
+ if (wcslen(buffer)>2 && buffer[0] != 0 && buffer[1] == ':') {
+ buffer[1]=buffer[0]|32;
+ buffer[0]='/';
+ }
+#endif
}
/* copy_absolute requires that path be allocated at least
@@ -234,8 +253,21 @@
static void
copy_absolute(wchar_t *path, wchar_t *p, size_t pathlen)
{
- if (p[0] == SEP)
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+ if (p[0] == SEP || (wcslen(p)>=2 && p[0] != 0 && p[1] == ':'))
+#else
+ if (p[0] == SEP)
+#endif
+ {
wcscpy(path, p);
+#if defined(__CYGWIN__)
+ /* MSYS specific: Turn C:* into /c* */
+ if (wcslen(path)>2 && path[0] != 0 && path[1] == ':') {
+ path[1]=path[0]|32;
+ path[0]='/';
+ }
+#endif
+ }
else {
if (!_Py_wgetcwd(path, pathlen)) {
/* unable to get the current directory */
@@ -451,6 +483,42 @@
return 0;
}
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+/* Calculates dllpath and progpath, replacing \\ with / */
+int GetWindowsModulePaths()
+{
+ int result = 0;
+ wchar_t* seps;
+ result = GetModuleFileNameW(NULL, progpath, MAXPATHLEN);
+ seps = wcschr(progpath, '\\');
+ while(seps) {
+ *seps = '/';
+ seps = wcschr(seps, '\\');
+ }
+ dllpath[0] = '\0';
+#if defined(Py_ENABLE_SHARED) && !defined(__CYGWIN__)
+ // Hmm, cygwin/MSYS2 replacement for PyWin_DLLhModule is needed.
+ if (PyWin_DLLhModule) {
+ if((GetModuleFileNameW(PyWin_DLLhModule, dllpath, MAXPATHLEN) > 0)) {
+ result = 1;
+ seps = wcschr(dllpath, '\\');
+ while(seps) {
+ *seps = '/';
+ seps = wcschr(seps, '\\');
+ }
+ }
+ }
+#endif
+
+ /* Just so that 'MSYS specific: Turn C:* into /c*'
+ is done. */
+ absolutize(progpath);
+ absolutize(dllpath);
+
+ return result;
+}
+#endif /* MS_WINDOWS */
+
static void
calculate_path(void)
{
@@ -527,6 +595,10 @@
}
}
#endif /* __APPLE__ */
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+ else if(GetWindowsModulePaths()) {
+ }
+#endif /* MS_WINDOWS */
else if (path) {
while (1) {
wchar_t *delim = wcschr(path, DELIM);

View File

@@ -0,0 +1,22 @@
--- Python-3.3.2-orig/Modules/signalmodule.c 2013-05-15 20:32:59.000000000 +0400
+++ python-3.3.2/Modules/signalmodule.c 2013-10-21 13:17:31.434200000 +0400
@@ -8,8 +8,18 @@
#include "posixmodule.h"
#endif
+#if defined(__CYGWIN__)
+/* Type siginfo_t is different on cygwin. For instance si_band is not
+ * a member of structure, so until fill_siginfo(siginfo_t *si) is
+ * ported properly lets "undef" sigwaitinfo and sigtimedwait to
+ * avoid build failure in fill_siginfo(..).
+ */
+# undef HAVE_SIGWAITINFO
+# undef HAVE_SIGTIMEDWAIT
+#endif
+
#ifdef MS_WINDOWS
-#include <Windows.h>
+#include <windows.h>
#ifdef HAVE_PROCESS_H
#include <process.h>
#endif

149
python3/PKGBUILD Normal file
View File

@@ -0,0 +1,149 @@
# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
pkgname=python
pkgver=3.3.2
pkgrel=1
_pybasever=3.3
pkgdesc="Next generation of the python high-level scripting language"
arch=('i686' 'x86_64')
license=('custom')
url="http://www.python.org/"
depends=('expat' 'bzip2' 'gdbm' 'openssl' 'libffi' 'zlib')
makedepends=('tk>=8.6.0' 'sqlite' 'valgrind' 'bluez-libs')
optdepends=('tk: for tkinter' 'sqlite')
provides=('python3')
replaces=('python3')
options=('!makeflags')
source=(http://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz
python-3.3.2-CVE-2013-2099.patch
python-3.3.2-CVE-2013-4238.patch
3.3-ctypes-libpython.patch
3.3-ctypes-util-find_library.patch
3.3-cygwin-soname.patch
3.3-dbm.patch
3.3-distutils-shlibext.patch
3.3-enable-new-dtags.patch
3.3-export-PyNode_SizeOf.patch
3.3-export-PySignal_SetWakeupFd.patch
3.3-fix-PyAPI-declaration.patch
3.3-fix-sqlite-module.patch
3.3-ncurses-abi6.patch
3.3-PATH_MAX.patch
3.3-pep3149.patch
3.3-ssl-threads.patch
3.3-thread-cygwin64.patch
3.3-tkinter.patch
3.3.2-allow-windows-paths-for-executable.patch
3.3.2-cygwin-siginfo.patch
python-3.3.2-msys2.patch
uuid.patch)
sha1sums=('87009d0c156c6e1354dfec5c98c328cae93950ad'
'bfe07759daacd4ffa0e682e65f0c9fb84f715c73'
'c30297201ef5cd803b685085ca6defb7ca66d2cd'
'd1bef43a80fbc99524fe599dabb84977fc4f458d'
'92109d70e398605c075cd969a89a7f16abd1ce59'
'a815d4c8b1ec8246be47b7eeeabe84cf47c11af8'
'df5a984858073d75a11500bad9178f842c6a1846'
'a12a1ed5ea15a34b650d407a7f7c4e8718de670f'
'a0b1a90f271f28322b0921820ce3cdf0c108e2ea'
'f505b46785e78c5f23a4228e756795e0e66dd1f3'
'09392741ab3d05d99c977a468ec38c7f94f49429'
'acf8a9ba965764941809404f2cfc5091af63bf8f'
'ec8b6015a8c56bd3cc873bc1da300a0517e9a549'
'86a4addb11ef38695b90cc91584b55e1878d21e6'
'e421f2770a7f7bbb85003b83945c8f5b3c0050d4'
'8295e7731fe1b6623365b4c5a789dec588db5769'
'bfe2e722693a7314243b494db5170e68fc36c3d5'
'1fb100b187ae64faa1ab15300a84d6e0e75e55c6'
'b303a2da60abded2ca020dfb63da5d5184c1d92f'
'd3cbd7286fab191a5a9086cea1a9a3dc386e17da'
'1ec44391e21ad83cd149e83e65b2e77af13b9fbd'
'4f5ef705c8806900313480e13fb8d34c49aeb77a'
'8b2f1bed347e764c2505ed2e9e5bccb790354d76')
prepare() {
cd "${srcdir}/Python-${pkgver}"
# FS#23997
sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py
patch -Np1 -i ${srcdir}/python-3.3.2-CVE-2013-2099.patch
patch -Np1 -i ${srcdir}/python-3.3.2-CVE-2013-4238.patch
patch -p1 -i ${srcdir}/3.3-dbm.patch
patch -p1 -i ${srcdir}/3.3-enable-new-dtags.patch
patch -p1 -i ${srcdir}/3.3-tkinter.patch
patch -p1 -i ${srcdir}/3.3-ctypes-util-find_library.patch
patch -p1 -i ${srcdir}/3.3-PATH_MAX.patch
patch -p1 -i ${srcdir}/3.3-ssl-threads.patch
patch -p1 -i ${srcdir}/3.3-ncurses-abi6.patch
patch -p1 -i ${srcdir}/3.3-export-PySignal_SetWakeupFd.patch
patch -p1 -i ${srcdir}/3.3-export-PyNode_SizeOf.patch
patch -p1 -i ${srcdir}/3.3-cygwin-soname.patch
patch -p1 -i ${srcdir}/3.3-distutils-shlibext.patch
patch -p1 -i ${srcdir}/3.3-ctypes-libpython.patch
patch -p1 -i ${srcdir}/3.3-pep3149.patch
patch -p1 -i ${srcdir}/3.3-thread-cygwin64.patch
patch -p1 -i ${srcdir}/3.3-fix-sqlite-module.patch
patch -p1 -i ${srcdir}/python-3.3.2-msys2.patch
patch -p1 -i ${srcdir}/uuid.patch
patch -p1 -i ${srcdir}/3.3.2-cygwin-siginfo.patch
# Incomplete patch from Ray Donnelly
# patch -p1 -i ${srcdir}/3.3.2-allow-windows-paths-for-executable.patch
# Ensure that we are using the system copy of various libraries (expat, zlib and libffi),
# rather than copies shipped in the tarball
rm -r Modules/expat
rm -r Modules/zlib
rm -r Modules/_ctypes/{darwin,libffi}*
}
build() {
cd "${srcdir}/Python-${pkgver}"
./configure --build=${CHOST} \
--prefix=/usr \
--build=$MY_TARGET \
--enable-shared \
--enable-ipv6 \
--with-libc= \
--with-libm= \
--with-system-expat \
--with-system-ffi \
ac_cv_func_bind_textdomain_codeset=yes \
--with-threads \
CPPFLAGS="${CPPFLAGS} -I/usr/include/ncursesw" \
LDFLAGS="${LDFLAGS} -L."
make
}
check() {
cd "${srcdir}/Python-${pkgver}"
"${srcdir}/Python-${pkgver}/python" -m test.regrtest -x test_posixpath test_logging
}
package() {
cd "${srcdir}/Python-${pkgver}"
make DESTDIR="${pkgdir}" install maninstall
# Why are these not done by default...
ln -sf python3 "${pkgdir}"/usr/bin/python.exe
ln -sf python3-config "${pkgdir}"/usr/bin/python-config
ln -sf idle3 "${pkgdir}"/usr/bin/idle
ln -sf pydoc3 "${pkgdir}"/usr/bin/pydoc
ln -sf python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python3.1
ln -sf python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python.1
# Fix FS#22552
cp -f "${pkgdir}"/usr/lib/python${_pybasever}/config-${_pybasever}m/libpython${_pybasever}m.dll.a "${pkgdir}"/usr/lib/libpython${_pybasever}m.dll.a
# Clean-up reference to build directory
sed -i "s|$srcdir/Python-${pkgver}:||" "$pkgdir/usr/lib/python${_pybasever}/config-${_pybasever}m/Makefile"
# License
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# fix permissons
find ${pkgdir}/usr -type f \( -name *.dll -o -name *.exe \) | xargs chmod 0755
}

View File

@@ -0,0 +1,49 @@
# HG changeset patch
# User Antoine Pitrou <solipsis@pitrou.net>
# Date 1368892602 -7200
# Node ID c627638753e2d25a98950585b259104a025937a9
# Parent 9682241dc8fcb4b1aef083bd30860efa070c3d6d
Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of service using certificates with many wildcards (CVE-2013-2099).
diff --git a/Lib/ssl.py b/Lib/ssl.py
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -129,9 +129,16 @@ class CertificateError(ValueError):
pass
-def _dnsname_to_pat(dn):
+def _dnsname_to_pat(dn, max_wildcards=1):
pats = []
for frag in dn.split(r'.'):
+ if frag.count('*') > max_wildcards:
+ # Issue #17980: avoid denials of service by refusing more
+ # than one wildcard per fragment. A survery of established
+ # policy among SSL implementations showed it to be a
+ # reasonable choice.
+ raise CertificateError(
+ "too many wildcards in certificate DNS name: " + repr(dn))
if frag == '*':
# When '*' is a fragment by itself, it matches a non-empty dotless
# fragment.
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -349,6 +349,17 @@ class BasicSocketTests(unittest.TestCase
self.assertRaises(ValueError, ssl.match_hostname, None, 'example.com')
self.assertRaises(ValueError, ssl.match_hostname, {}, 'example.com')
+ # Issue #17980: avoid denials of service by refusing more than one
+ # wildcard per fragment.
+ cert = {'subject': ((('commonName', 'a*b.com'),),)}
+ ok(cert, 'axxb.com')
+ cert = {'subject': ((('commonName', 'a*b.co*'),),)}
+ ok(cert, 'axxb.com')
+ cert = {'subject': ((('commonName', 'a*b*.com'),),)}
+ with self.assertRaises(ssl.CertificateError) as cm:
+ ssl.match_hostname(cert, 'axxbxxc.com')
+ self.assertIn("too many wildcards", str(cm.exception))
+
def test_server_side(self):
# server_hostname doesn't work for server sockets
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)

View File

@@ -0,0 +1,255 @@
# HG changeset patch
# User Christian Heimes <christian@cheimes.de>
# Date 1376693687 -7200
# Node ID c9f073e593b037e8a29e386326859537691bcf62
# Parent 3105b78d34346ea36c52a3b7e635954f4b444120
Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes
inside subjectAltName correctly. Formerly the module has used OpenSSL's
GENERAL_NAME_print() function to get the string represention of ASN.1
strings for rfc822Name (email), dNSName (DNS) and
uniformResourceIdentifier (URI).
diff --git a/Lib/test/nullbytecert.pem b/Lib/test/nullbytecert.pem
new file mode 100644
--- /dev/null
+++ b/Lib/test/nullbytecert.pem
@@ -0,0 +1,90 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
+ Validity
+ Not Before: Aug 7 13:11:52 2013 GMT
+ Not After : Aug 7 13:12:52 2013 GMT
+ Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
+ 03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
+ 16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
+ 88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
+ 32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
+ 56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
+ a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
+ 45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
+ ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
+ 90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
+ 7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
+ 68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
+ f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
+ f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
+ ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
+ d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
+ 9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
+ 2f:85
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:FALSE
+ X509v3 Subject Key Identifier:
+ 88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Alternative Name:
+ *************************************************************
+ WARNING: The values for DNS, email and URI are WRONG. OpenSSL
+ doesn't print the text after a NULL byte.
+ *************************************************************
+ DNS:altnull.python.org, email:null@python.org, URI:http://null.python.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
+ Signature Algorithm: sha1WithRSAEncryption
+ ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
+ a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
+ 3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
+ 86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
+ 56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
+ de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
+ 3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
+ 60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
+ d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
+ 25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
+ 1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
+ 4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
+ 0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
+ 5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
+ c1:ca:a9:94
+-----BEGIN CERTIFICATE-----
+MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
+DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
+eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
+RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
+ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
+NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
+DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
+ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
+ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
+hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
+BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
+pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
+vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
+KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
+oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
+08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
+HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
+BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
+Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
+bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
+AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
+i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
+HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
+kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
+VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
+RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
+-----END CERTIFICATE-----
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -55,6 +55,7 @@ BADCERT = data_file("badcert.pem")
WRONGCERT = data_file("XXXnonexisting.pem")
BADKEY = data_file("badkey.pem")
NOKIACERT = data_file("nokia.pem")
+NULLBYTECERT = data_file("nullbytecert.pem")
DHFILE = data_file("dh512.pem")
BYTES_DHFILE = os.fsencode(DHFILE)
@@ -162,6 +163,27 @@ class BasicSocketTests(unittest.TestCase
('DNS', 'projects.forum.nokia.com'))
)
+ def test_parse_cert_CVE_2013_4238(self):
+ p = ssl._ssl._test_decode_cert(NULLBYTECERT)
+ if support.verbose:
+ sys.stdout.write("\n" + pprint.pformat(p) + "\n")
+ subject = ((('countryName', 'US'),),
+ (('stateOrProvinceName', 'Oregon'),),
+ (('localityName', 'Beaverton'),),
+ (('organizationName', 'Python Software Foundation'),),
+ (('organizationalUnitName', 'Python Core Development'),),
+ (('commonName', 'null.python.org\x00example.org'),),
+ (('emailAddress', 'python-dev@python.org'),))
+ self.assertEqual(p['subject'], subject)
+ self.assertEqual(p['issuer'], subject)
+ self.assertEqual(p['subjectAltName'],
+ (('DNS', 'altnull.python.org\x00example.com'),
+ ('email', 'null@python.org\x00user@example.org'),
+ ('URI', 'http://null.python.org\x00http://example.org'),
+ ('IP Address', '192.0.2.1'),
+ ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
+ )
+
def test_DER_to_PEM(self):
with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:
pem = f.read()
@@ -294,6 +316,13 @@ class BasicSocketTests(unittest.TestCase
fail(cert, 'foo.a.com')
fail(cert, 'bar.foo.com')
+ # NULL bytes are bad, CVE-2013-4073
+ cert = {'subject': ((('commonName',
+ 'null.python.org\x00example.org'),),)}
+ ok(cert, 'null.python.org\x00example.org') # or raise an error?
+ fail(cert, 'example.org')
+ fail(cert, 'null.python.org')
+
# Slightly fake real-world example
cert = {'notAfter': 'Jun 26 21:41:46 2011 GMT',
'subject': ((('commonName', 'linuxfrz.org'),),),
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -771,12 +771,14 @@ static PyObject *
ext->value->length));
for(j = 0; j < sk_GENERAL_NAME_num(names); j++) {
-
/* get a rendering of each name in the set of names */
+ int gntype;
+ ASN1_STRING *as = NULL;
name = sk_GENERAL_NAME_value(names, j);
- if (name->type == GEN_DIRNAME) {
-
+ gntype = name-> type;
+ switch (gntype) {
+ case GEN_DIRNAME:
/* we special-case DirName as a tuple of
tuples of attributes */
@@ -798,11 +800,62 @@ static PyObject *
goto fail;
}
PyTuple_SET_ITEM(t, 1, v);
+ break;
- } else {
+ case GEN_EMAIL:
+ case GEN_DNS:
+ case GEN_URI:
+ /* GENERAL_NAME_print() doesn't handle NULL bytes in ASN1_string
+ correctly, CVE-2013-4238 */
+ t = PyTuple_New(2);
+ if (t == NULL)
+ goto fail;
+ switch (gntype) {
+ case GEN_EMAIL:
+ v = PyUnicode_FromString("email");
+ as = name->d.rfc822Name;
+ break;
+ case GEN_DNS:
+ v = PyUnicode_FromString("DNS");
+ as = name->d.dNSName;
+ break;
+ case GEN_URI:
+ v = PyUnicode_FromString("URI");
+ as = name->d.uniformResourceIdentifier;
+ break;
+ }
+ if (v == NULL) {
+ Py_DECREF(t);
+ goto fail;
+ }
+ PyTuple_SET_ITEM(t, 0, v);
+ v = PyUnicode_FromStringAndSize((char *)ASN1_STRING_data(as),
+ ASN1_STRING_length(as));
+ if (v == NULL) {
+ Py_DECREF(t);
+ goto fail;
+ }
+ PyTuple_SET_ITEM(t, 1, v);
+ break;
+ default:
/* for everything else, we use the OpenSSL print form */
-
+ switch (gntype) {
+ /* check for new general name type */
+ case GEN_OTHERNAME:
+ case GEN_X400:
+ case GEN_EDIPARTY:
+ case GEN_IPADD:
+ case GEN_RID:
+ break;
+ default:
+ if (PyErr_WarnFormat(PyExc_RuntimeWarning, 1,
+ "Unknown general name type %d",
+ gntype) == -1) {
+ goto fail;
+ }
+ break;
+ }
(void) BIO_reset(biobuf);
GENERAL_NAME_print(biobuf, name);
len = BIO_gets(biobuf, buf, sizeof(buf)-1);
@@ -829,6 +882,7 @@ static PyObject *
goto fail;
}
PyTuple_SET_ITEM(t, 1, v);
+ break;
}
/* and add that rendering to the list */

File diff suppressed because it is too large Load Diff

12
python3/uuid.patch Normal file
View File

@@ -0,0 +1,12 @@
diff -r 4a318a45c4c3 Lib/uuid.py
--- a/Lib/uuid.py Mon Aug 19 13:07:18 2013 -0400
+++ b/Lib/uuid.py Mon Aug 19 21:41:08 2013 +0400
@@ -429,6 +429,8 @@
_uuid_generate_random = lib.uuid_generate_random
if hasattr(lib, 'uuid_generate_time'):
_uuid_generate_time = lib.uuid_generate_time
+ if _uuid_generate_random is not None:
+ break # found everything we were looking for
# The uuid_generate_* functions are broken on MacOS X 10.5, as noted
# in issue #8621 the function generates the same sequence of values