diff options
Diffstat (limited to 'dev-lang/python/files')
-rw-r--r-- | dev-lang/python/files/python-2.7.10-semaphore-urandom.patch | 38 | ||||
-rw-r--r-- | dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch | 13 |
2 files changed, 51 insertions, 0 deletions
diff --git a/dev-lang/python/files/python-2.7.10-semaphore-urandom.patch b/dev-lang/python/files/python-2.7.10-semaphore-urandom.patch new file mode 100644 index 00000000..fa3b8304 --- /dev/null +++ b/dev-lang/python/files/python-2.7.10-semaphore-urandom.patch @@ -0,0 +1,38 @@ +Fix for semaphores in pid namespaces + +http://bugs.python.org/issue24303 + +diff -r 5576c8240963 Modules/_multiprocessing/semaphore.c +--- a/Modules/_multiprocessing/semaphore.c Wed Apr 15 19:30:38 2015 +0100 ++++ b/Modules/_multiprocessing/semaphore.c Thu Jun 11 07:08:36 2015 +0100 +@@ -429,7 +429,7 @@ + int kind, maxvalue, value; + PyObject *result; + static char *kwlist[] = {"kind", "value", "maxvalue", NULL}; +- static int counter = 0; ++ int try = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwlist, + &kind, &value, &maxvalue)) +@@ -440,10 +440,18 @@ + return NULL; + } + +- PyOS_snprintf(buffer, sizeof(buffer), "/mp%ld-%d", (long)getpid(), counter++); ++ /* Create a semaphore with a unique name. The bytes returned by ++ * _PyOS_URandom() are treated as unsigned long to ensure that the filename ++ * is valid (no special characters). */ ++ do { ++ unsigned long suffix; ++ _PyOS_URandom((char *)&suffix, sizeof(suffix)); ++ PyOS_snprintf(buffer, sizeof(buffer), "/mp%ld-%lu", (long)getpid(), ++ suffix); ++ SEM_CLEAR_ERROR(); ++ handle = SEM_CREATE(buffer, value, maxvalue); ++ } while ((handle == SEM_FAILED) && (errno == EEXIST) && (++try < 100)); + +- SEM_CLEAR_ERROR(); +- handle = SEM_CREATE(buffer, value, maxvalue); + /* On Windows we should fail if GetLastError()==ERROR_ALREADY_EXISTS */ + if (handle == SEM_FAILED || SEM_GET_LAST_ERROR() != 0) + goto failure; diff --git a/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch b/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch new file mode 100644 index 00000000..38ce6f78 --- /dev/null +++ b/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch @@ -0,0 +1,13 @@ +do not hardcode /usr/include paths + +--- a/configure.ac ++++ b/configure.ac +@@ -4316,7 +4316,7 @@ fi + + # first curses configure check + ac_save_cppflags="$CPPFLAGS" +-CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" ++CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags ncursesw`" + + AC_CHECK_HEADERS(curses.h ncurses.h) + |