diff options
author | nectar <nectar@FreeBSD.org> | 2002-11-15 00:52:24 +0800 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2002-11-15 00:52:24 +0800 |
commit | e038a5ec129d0eb73210dad2909a25f0b939d7d8 (patch) | |
tree | 5b0e2d017f5631bee03597b83e569b0df75b2064 /lang/python20 | |
parent | 19cbc2c4e91bd2df1505122de5019b4402ae24eb (diff) | |
download | freebsd-ports-gnome-e038a5ec129d0eb73210dad2909a25f0b939d7d8.tar.gz freebsd-ports-gnome-e038a5ec129d0eb73210dad2909a25f0b939d7d8.tar.zst freebsd-ports-gnome-e038a5ec129d0eb73210dad2909a25f0b939d7d8.zip |
Backport fix for temporary file handling bug in os._execvpe() from
Python 2.2.2.
Not approved by: tg (short timeout)
Diffstat (limited to 'lang/python20')
-rw-r--r-- | lang/python20/Makefile | 1 | ||||
-rw-r--r-- | lang/python20/files/patch-Lib:os.py | 76 |
2 files changed, 77 insertions, 0 deletions
diff --git a/lang/python20/Makefile b/lang/python20/Makefile index badff2a277e2..e3fbaa3df64d 100644 --- a/lang/python20/Makefile +++ b/lang/python20/Makefile @@ -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} \ diff --git a/lang/python20/files/patch-Lib:os.py b/lang/python20/files/patch-Lib:os.py new file mode 100644 index 000000000000..b11bae7fccab --- /dev/null +++ b/lang/python20/files/patch-Lib:os.py @@ -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: |