FreeBSD Bugzilla – Attachment 209497 Details for
Bug 242274
lang/python{27,35,36,37,38}: Add closefrom(2) support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
svn(1) diff against the ports tree
python-closefrom.diff (text/plain), 12.75 KB, created by
Kyle Evans
on 2019-11-27 23:32:51 UTC
(
hide
)
Description:
svn(1) diff against the ports tree
Filename:
MIME Type:
Creator:
Kyle Evans
Created:
2019-11-27 23:32:51 UTC
Size:
12.75 KB
patch
obsolete
>Index: lang/python27/Makefile >=================================================================== >--- lang/python27/Makefile (revision 518548) >+++ lang/python27/Makefile (working copy) >@@ -2,6 +2,7 @@ > > PORTNAME= python > PORTVERSION= ${PYTHON_PORTVERSION} >+PORTREVISION= 1 > CATEGORIES= lang python > MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} > PKGNAMESUFFIX= 27 >Index: lang/python27/files/patch-Modules_posixmodule.c >=================================================================== >--- lang/python27/files/patch-Modules_posixmodule.c (nonexistent) >+++ lang/python27/files/patch-Modules_posixmodule.c (working copy) >@@ -0,0 +1,19 @@ >+--- Modules/posixmodule.c.orig 2019-11-27 22:47:11 UTC >++++ Modules/posixmodule.c >+@@ -6676,9 +6676,13 @@ posix_closerange(PyObject *self, PyObject *args) >+ if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to)) >+ return NULL; >+ Py_BEGIN_ALLOW_THREADS >+- for (i = fd_from; i < fd_to; i++) >+- if (_PyVerify_fd(i)) >+- close(i); >++ if (fd_to >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(fd_from); >++ } else { >++ for (i = fd_from; i < fd_to; i++) >++ if (_PyVerify_fd(i)) >++ close(i); >++ } >+ Py_END_ALLOW_THREADS >+ Py_RETURN_NONE; >+ } > >Property changes on: lang/python27/files/patch-Modules_posixmodule.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python35/Makefile >=================================================================== >--- lang/python35/Makefile (revision 518548) >+++ lang/python35/Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= python > PORTVERSION= ${PYTHON_PORTVERSION} >-PORTREVISION= 2 >+PORTREVISION= 3 > CATEGORIES= lang python > MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} > PKGNAMESUFFIX= ${PYTHON_SUFFIX} >Index: lang/python35/files/patch-Modules___posixsubprocess.c >=================================================================== >--- lang/python35/files/patch-Modules___posixsubprocess.c (nonexistent) >+++ lang/python35/files/patch-Modules___posixsubprocess.c (working copy) >@@ -0,0 +1,17 @@ >+--- Modules/_posixsubprocess.c.orig 2019-11-27 23:01:59 UTC >++++ Modules/_posixsubprocess.c >+@@ -233,8 +233,12 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_ >+ start_fd = keep_fd + 1; >+ } >+ if (start_fd <= end_fd) { >+- for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >+- close(fd_num); >++ if (end_fd >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(start_fd); >++ } else { >++ for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >++ close(fd_num); >++ } >+ } >+ } >+ } > >Property changes on: lang/python35/files/patch-Modules___posixsubprocess.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python35/files/patch-Modules_posixmodule.c >=================================================================== >--- lang/python35/files/patch-Modules_posixmodule.c (nonexistent) >+++ lang/python35/files/patch-Modules_posixmodule.c (working copy) >@@ -0,0 +1,19 @@ >+--- Modules/posixmodule.c.orig 2019-11-27 23:03:12 UTC >++++ Modules/posixmodule.c >+@@ -7853,9 +7853,13 @@ os_closerange_impl(PyObject *module, int fd_low, int f >+ int i; >+ Py_BEGIN_ALLOW_THREADS >+ _Py_BEGIN_SUPPRESS_IPH >+- for (i = fd_low; i < fd_high; i++) >+- if (_PyVerify_fd(i)) >+- close(i); >++ if (fd_high >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(fd_low); >++ } else { >++ for (i = fd_low; i < fd_high; i++) >++ if (_PyVerify_fd(i)) >++ close(i); >++ } >+ _Py_END_SUPPRESS_IPH >+ Py_END_ALLOW_THREADS >+ Py_RETURN_NONE; > >Property changes on: lang/python35/files/patch-Modules_posixmodule.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python36/Makefile >=================================================================== >--- lang/python36/Makefile (revision 518548) >+++ lang/python36/Makefile (working copy) >@@ -3,6 +3,7 @@ > > PORTNAME= python > PORTVERSION= ${PYTHON_PORTVERSION} >+PORTREVISION= 1 > CATEGORIES= lang python > MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} > PKGNAMESUFFIX= ${PYTHON_SUFFIX} >Index: lang/python36/files/patch-Modules___posixsubprocess.c >=================================================================== >--- lang/python36/files/patch-Modules___posixsubprocess.c (nonexistent) >+++ lang/python36/files/patch-Modules___posixsubprocess.c (working copy) >@@ -0,0 +1,17 @@ >+--- Modules/_posixsubprocess.c.orig 2019-07-02 20:25:39 UTC >++++ Modules/_posixsubprocess.c >+@@ -236,8 +236,12 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_ >+ start_fd = keep_fd + 1; >+ } >+ if (start_fd <= end_fd) { >+- for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >+- close(fd_num); >++ if (end_fd >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(start_fd); >++ } else { >++ for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >++ close(fd_num); >++ } >+ } >+ } >+ } > >Property changes on: lang/python36/files/patch-Modules___posixsubprocess.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python36/files/patch-Modules_posixmodule.c >=================================================================== >--- lang/python36/files/patch-Modules_posixmodule.c (nonexistent) >+++ lang/python36/files/patch-Modules_posixmodule.c (working copy) >@@ -0,0 +1,18 @@ >+--- Modules/posixmodule.c.orig 2019-07-02 20:25:39 UTC >++++ Modules/posixmodule.c >+@@ -7685,8 +7685,13 @@ os_closerange_impl(PyObject *module, int fd_low, int f >+ int i; >+ Py_BEGIN_ALLOW_THREADS >+ _Py_BEGIN_SUPPRESS_IPH >+- for (i = Py_MAX(fd_low, 0); i < fd_high; i++) >+- close(i); >++ fd_low = Py_MAX(fd_low, 0); >++ if (fd_high >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(fd_low); >++ } else { >++ for (i = fd_low; i < fd_high; i++) >++ close(i); >++ } >+ _Py_END_SUPPRESS_IPH >+ Py_END_ALLOW_THREADS >+ Py_RETURN_NONE; > >Property changes on: lang/python36/files/patch-Modules_posixmodule.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python37/Makefile >=================================================================== >--- lang/python37/Makefile (revision 518548) >+++ lang/python37/Makefile (working copy) >@@ -3,6 +3,7 @@ > > PORTNAME= python > PORTVERSION= ${PYTHON_PORTVERSION} >+PORTREVISION= 1 > CATEGORIES= lang python > MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} > PKGNAMESUFFIX= ${PYTHON_SUFFIX} >Index: lang/python37/files/patch-Modules___posixsubprocess.c >=================================================================== >--- lang/python37/files/patch-Modules___posixsubprocess.c (nonexistent) >+++ lang/python37/files/patch-Modules___posixsubprocess.c (working copy) >@@ -0,0 +1,17 @@ >+--- Modules/_posixsubprocess.c.orig 2019-07-02 20:25:39 UTC >++++ Modules/_posixsubprocess.c >+@@ -236,8 +236,12 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_ >+ start_fd = keep_fd + 1; >+ } >+ if (start_fd <= end_fd) { >+- for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >+- close(fd_num); >++ if (end_fd >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(start_fd); >++ } else { >++ for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >++ close(fd_num); >++ } >+ } >+ } >+ } > >Property changes on: lang/python37/files/patch-Modules___posixsubprocess.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python37/files/patch-Modules_posixmodule.c >=================================================================== >--- lang/python37/files/patch-Modules_posixmodule.c (nonexistent) >+++ lang/python37/files/patch-Modules_posixmodule.c (working copy) >@@ -0,0 +1,18 @@ >+--- Modules/posixmodule.c.orig 2019-07-02 20:25:39 UTC >++++ Modules/posixmodule.c >+@@ -7685,8 +7685,13 @@ os_closerange_impl(PyObject *module, int fd_low, int f >+ int i; >+ Py_BEGIN_ALLOW_THREADS >+ _Py_BEGIN_SUPPRESS_IPH >+- for (i = Py_MAX(fd_low, 0); i < fd_high; i++) >+- close(i); >++ fd_low = Py_MAX(fd_low, 0); >++ if (fd_high >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(fd_low); >++ } else { >++ for (i = fd_low; i < fd_high; i++) >++ close(i); >++ } >+ _Py_END_SUPPRESS_IPH >+ Py_END_ALLOW_THREADS >+ Py_RETURN_NONE; > >Property changes on: lang/python37/files/patch-Modules_posixmodule.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python38/Makefile >=================================================================== >--- lang/python38/Makefile (revision 518548) >+++ lang/python38/Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= python > PORTVERSION= ${PYTHON_PORTVERSION} >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= lang python > MASTER_SITES= PYTHON/ftp/python/${PORTVERSION} > PKGNAMESUFFIX= ${PYTHON_SUFFIX} >Index: lang/python38/files/patch-Modules___posixsubprocess.c >=================================================================== >--- lang/python38/files/patch-Modules___posixsubprocess.c (nonexistent) >+++ lang/python38/files/patch-Modules___posixsubprocess.c (working copy) >@@ -0,0 +1,17 @@ >+--- Modules/_posixsubprocess.c.orig 2019-07-02 20:25:39 UTC >++++ Modules/_posixsubprocess.c >+@@ -236,8 +236,12 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_ >+ start_fd = keep_fd + 1; >+ } >+ if (start_fd <= end_fd) { >+- for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >+- close(fd_num); >++ if (end_fd >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(start_fd); >++ } else { >++ for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { >++ close(fd_num); >++ } >+ } >+ } >+ } > >Property changes on: lang/python38/files/patch-Modules___posixsubprocess.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: lang/python38/files/patch-Modules_posixmodule.c >=================================================================== >--- lang/python38/files/patch-Modules_posixmodule.c (nonexistent) >+++ lang/python38/files/patch-Modules_posixmodule.c (working copy) >@@ -0,0 +1,18 @@ >+--- Modules/posixmodule.c.orig 2019-10-14 13:34:47 UTC >++++ Modules/posixmodule.c >+@@ -8460,8 +8460,13 @@ os_closerange_impl(PyObject *module, int fd_low, int f >+ lohi[1] = fd_high; >+ fdwalk(_fdwalk_close_func, lohi); >+ #else >+- for (i = Py_MAX(fd_low, 0); i < fd_high; i++) >+- close(i); >++ fd_low = Py_MAX(fd_low, 0); >++ if (fd_high >= sysconf(_SC_OPEN_MAX)) { >++ closefrom(fd_low); >++ } else { >++ for (i = fd_low; i < fd_high; i++) >++ close(i); >++ } >+ #endif >+ _Py_END_SUPPRESS_IPH >+ Py_END_ALLOW_THREADS > >Property changes on: lang/python38/files/patch-Modules_posixmodule.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 242274
:
209497
|
209518