Backport fix for temporary file handling bug in os._execvpe() from
Python 2.2.2. Not approved by: tg (short timeout)
This commit is contained in:
parent
f20a5c3128
commit
4a46e91cbf
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=70118
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= python
|
||||
PORTVERSION= 1.5.2
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= lang python
|
||||
MASTER_SITES= ftp://www.python.org/pub/python/src/ \
|
||||
ftp://ftp.cwi.nl/pub/python/src/
|
||||
|
76
lang/python15/files/patch-Lib:os.py
Normal file
76
lang/python15/files/patch-Lib:os.py
Normal file
@ -0,0 +1,76 @@
|
||||
*** Lib/os.py.orig Mon Feb 22 09:40:34 1999
|
||||
--- Lib/os.py Mon Nov 11 15:08:52 2002
|
||||
***************
|
||||
*** 185,192 ****
|
||||
def execvpe(file, args, env):
|
||||
_execvpe(file, args, env)
|
||||
|
||||
- _notfound = None
|
||||
def _execvpe(file, args, env = None):
|
||||
if env:
|
||||
func = execve
|
||||
argrest = (args, env)
|
||||
--- 185,193 ----
|
||||
def execvpe(file, args, env):
|
||||
_execvpe(file, args, env)
|
||||
|
||||
def _execvpe(file, args, env = None):
|
||||
+ from errno import ENOENT, ENOTDIR
|
||||
+
|
||||
if env:
|
||||
func = execve
|
||||
argrest = (args, env)
|
||||
***************
|
||||
*** 194,200 ****
|
||||
func = execv
|
||||
argrest = (args,)
|
||||
env = environ
|
||||
- global _notfound
|
||||
head, tail = path.split(file)
|
||||
if head:
|
||||
apply(func, (file,) + argrest)
|
||||
--- 195,200 ----
|
||||
***************
|
||||
*** 205,224 ****
|
||||
envpath = defpath
|
||||
import string
|
||||
PATH = string.splitfields(envpath, pathsep)
|
||||
! if not _notfound:
|
||||
! import tempfile
|
||||
! # Exec a file that is guaranteed not to exist
|
||||
! try: execv(tempfile.mktemp(), ())
|
||||
! except error, _notfound: pass
|
||||
! exc, arg = error, _notfound
|
||||
for dir in PATH:
|
||||
fullname = path.join(dir, file)
|
||||
try:
|
||||
apply(func, (fullname,) + argrest)
|
||||
! except error, (errno, msg):
|
||||
! if errno != arg[0]:
|
||||
! exc, arg = error, (errno, msg)
|
||||
! raise exc, arg
|
||||
|
||||
# Change environ to automatically call putenv() if it exists
|
||||
try:
|
||||
--- 205,225 ----
|
||||
envpath = defpath
|
||||
import string
|
||||
PATH = string.splitfields(envpath, pathsep)
|
||||
! saved_exc = None
|
||||
! saved_tb = None
|
||||
for dir in PATH:
|
||||
fullname = path.join(dir, file)
|
||||
try:
|
||||
apply(func, (fullname,) + argrest)
|
||||
! except error, e:
|
||||
! tb = sys.exc_info()[2]
|
||||
! if (e.errno != ENOENT and e.errno != ENOTDIR
|
||||
! and saved_exc is None):
|
||||
! saved_exc = e
|
||||
! saved_tb = tb
|
||||
! if saved_exc:
|
||||
! raise error, saved_exc, saved_tb
|
||||
! raise error, e, tb
|
||||
|
||||
# Change environ to automatically call putenv() if it exists
|
||||
try:
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= python
|
||||
PORTVERSION= 2.0.1
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= lang python
|
||||
MASTER_SITES= http://www.python.org/ftp/python/${PORTVERSION}/ \
|
||||
${MASTER_SITE_SOURCEFORGE} \
|
||||
|
76
lang/python20/files/patch-Lib:os.py
Normal file
76
lang/python20/files/patch-Lib:os.py
Normal file
@ -0,0 +1,76 @@
|
||||
*** Lib/os.py.orig Thu Sep 28 14:10:56 2000
|
||||
--- Lib/os.py Mon Nov 11 15:18:05 2002
|
||||
***************
|
||||
*** 234,241 ****
|
||||
args may be a list or tuple of strings. """
|
||||
_execvpe(file, args, env)
|
||||
|
||||
- _notfound = None
|
||||
def _execvpe(file, args, env=None):
|
||||
if env is not None:
|
||||
func = execve
|
||||
argrest = (args, env)
|
||||
--- 234,242 ----
|
||||
args may be a list or tuple of strings. """
|
||||
_execvpe(file, args, env)
|
||||
|
||||
def _execvpe(file, args, env=None):
|
||||
+ from errno import ENOENT, ENOTDIR
|
||||
+
|
||||
if env is not None:
|
||||
func = execve
|
||||
argrest = (args, env)
|
||||
***************
|
||||
*** 243,249 ****
|
||||
func = execv
|
||||
argrest = (args,)
|
||||
env = environ
|
||||
- global _notfound
|
||||
head, tail = path.split(file)
|
||||
if head:
|
||||
apply(func, (file,) + argrest)
|
||||
--- 244,249 ----
|
||||
***************
|
||||
*** 253,272 ****
|
||||
else:
|
||||
envpath = defpath
|
||||
PATH = envpath.split(pathsep)
|
||||
! if not _notfound:
|
||||
! import tempfile
|
||||
! # Exec a file that is guaranteed not to exist
|
||||
! try: execv(tempfile.mktemp(), ('blah',))
|
||||
! except error, _notfound: pass
|
||||
! exc, arg = error, _notfound
|
||||
for dir in PATH:
|
||||
fullname = path.join(dir, file)
|
||||
try:
|
||||
apply(func, (fullname,) + argrest)
|
||||
! except error, (errno, msg):
|
||||
! if errno != arg[0]:
|
||||
! exc, arg = error, (errno, msg)
|
||||
! raise exc, arg
|
||||
|
||||
# Change environ to automatically call putenv() if it exists
|
||||
try:
|
||||
--- 253,273 ----
|
||||
else:
|
||||
envpath = defpath
|
||||
PATH = envpath.split(pathsep)
|
||||
! saved_exc = None
|
||||
! saved_tb = None
|
||||
for dir in PATH:
|
||||
fullname = path.join(dir, file)
|
||||
try:
|
||||
apply(func, (fullname,) + argrest)
|
||||
! except error, e:
|
||||
! tb = sys.exc_info()[2]
|
||||
! if (e.errno != ENOENT and e.errno != ENOTDIR
|
||||
! and saved_exc is None):
|
||||
! saved_exc = e
|
||||
! saved_tb = tb
|
||||
! if saved_exc:
|
||||
! raise error, saved_exc, saved_tb
|
||||
! raise error, e, tb
|
||||
|
||||
# Change environ to automatically call putenv() if it exists
|
||||
try:
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= python
|
||||
PORTVERSION= 2.1.3
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= lang python
|
||||
MASTER_SITES= http://www.python.org/ftp/python/${PORTVERSION}/ \
|
||||
${MASTER_SITE_SOURCEFORGE} \
|
||||
|
93
lang/python21/files/patch-Lib:os.py
Normal file
93
lang/python21/files/patch-Lib:os.py
Normal file
@ -0,0 +1,93 @@
|
||||
*** Lib/os.py.orig Mon Nov 11 15:04:17 2002
|
||||
--- Lib/os.py Mon Nov 11 15:05:36 2002
|
||||
***************
|
||||
*** 301,308 ****
|
||||
|
||||
__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
|
||||
|
||||
- _notfound = None
|
||||
def _execvpe(file, args, env=None):
|
||||
if env is not None:
|
||||
func = execve
|
||||
argrest = (args, env)
|
||||
--- 301,309 ----
|
||||
|
||||
__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
|
||||
|
||||
def _execvpe(file, args, env=None):
|
||||
+ from errno import ENOENT, ENOTDIR
|
||||
+
|
||||
if env is not None:
|
||||
func = execve
|
||||
argrest = (args, env)
|
||||
***************
|
||||
*** 310,316 ****
|
||||
func = execv
|
||||
argrest = (args,)
|
||||
env = environ
|
||||
! global _notfound
|
||||
head, tail = path.split(file)
|
||||
if head:
|
||||
apply(func, (file,) + argrest)
|
||||
--- 311,317 ----
|
||||
func = execv
|
||||
argrest = (args,)
|
||||
env = environ
|
||||
!
|
||||
head, tail = path.split(file)
|
||||
if head:
|
||||
apply(func, (file,) + argrest)
|
||||
***************
|
||||
*** 320,349 ****
|
||||
else:
|
||||
envpath = defpath
|
||||
PATH = envpath.split(pathsep)
|
||||
! if not _notfound:
|
||||
! if sys.platform[:4] == 'beos':
|
||||
! # Process handling (fork, wait) under BeOS (up to 5.0)
|
||||
! # doesn't interoperate reliably with the thread interlocking
|
||||
! # that happens during an import. The actual error we need
|
||||
! # is the same on BeOS for posix.open() et al., ENOENT.
|
||||
! try: unlink('/_#.# ## #.#')
|
||||
! except error, _notfound: pass
|
||||
! else:
|
||||
! import tempfile
|
||||
! t = tempfile.mktemp()
|
||||
! # Exec a file that is guaranteed not to exist
|
||||
! try: execv(t, ('blah',))
|
||||
! except error, _notfound: pass
|
||||
! exc, arg = error, _notfound
|
||||
for dir in PATH:
|
||||
fullname = path.join(dir, file)
|
||||
try:
|
||||
apply(func, (fullname,) + argrest)
|
||||
! except error, (errno, msg):
|
||||
! if errno != arg[0]:
|
||||
! exc, arg = error, (errno, msg)
|
||||
! raise exc, arg
|
||||
!
|
||||
|
||||
# Change environ to automatically call putenv() if it exists
|
||||
try:
|
||||
--- 321,341 ----
|
||||
else:
|
||||
envpath = defpath
|
||||
PATH = envpath.split(pathsep)
|
||||
! saved_exc = None
|
||||
! saved_tb = None
|
||||
for dir in PATH:
|
||||
fullname = path.join(dir, file)
|
||||
try:
|
||||
apply(func, (fullname,) + argrest)
|
||||
! except error, e:
|
||||
! tb = sys.exc_info()[2]
|
||||
! if (e.errno != ENOENT and e.errno != ENOTDIR
|
||||
! and saved_exc is None):
|
||||
! saved_exc = e
|
||||
! saved_tb = tb
|
||||
! if saved_exc:
|
||||
! raise error, saved_exc, saved_tb
|
||||
! raise error, e, tb
|
||||
|
||||
# Change environ to automatically call putenv() if it exists
|
||||
try:
|
19
lang/python21/files/patch-Modules:Setup.dist
Normal file
19
lang/python21/files/patch-Modules:Setup.dist
Normal file
@ -0,0 +1,19 @@
|
||||
*** Modules/Setup.dist.orig Mon Nov 11 15:38:27 2002
|
||||
--- Modules/Setup.dist Mon Nov 11 15:38:41 2002
|
||||
***************
|
||||
*** 162,168 ****
|
||||
#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
|
||||
#pwd pwdmodule.c # pwd(3)
|
||||
#grp grpmodule.c # grp(3)
|
||||
! #errno errnomodule.c # posix (UNIX) errno values
|
||||
#select selectmodule.c # select(2); not on ancient System V
|
||||
|
||||
# Memory-mapped files (also works on Win32).
|
||||
--- 162,168 ----
|
||||
#fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
|
||||
#pwd pwdmodule.c # pwd(3)
|
||||
#grp grpmodule.c # grp(3)
|
||||
! errno errnomodule.c # posix (UNIX) errno values
|
||||
#select selectmodule.c # select(2); not on ancient System V
|
||||
|
||||
# Memory-mapped files (also works on Win32).
|
Loading…
Reference in New Issue
Block a user