head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.10 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.8 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.6 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.4 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.2 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.1.0.48 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.46 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.44 cube-native-xorg-base:1.1 pkgsrc-2008Q2:1.1.0.42 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.40 pkgsrc-2008Q1:1.1.0.38 pkgsrc-2008Q1-base:1.1 pkgsrc-2007Q4:1.1.0.36 pkgsrc-2007Q4-base:1.1 pkgsrc-2007Q3:1.1.0.34 pkgsrc-2007Q3-base:1.1 pkgsrc-2007Q2:1.1.0.32 pkgsrc-2007Q2-base:1.1 pkgsrc-2007Q1:1.1.0.30 pkgsrc-2007Q1-base:1.1 pkgsrc-2006Q4:1.1.0.28 pkgsrc-2006Q4-base:1.1 pkgsrc-2006Q3:1.1.0.26 pkgsrc-2006Q3-base:1.1 pkgsrc-2006Q2:1.1.0.24 pkgsrc-2006Q2-base:1.1 pkgsrc-2006Q1:1.1.0.22 pkgsrc-2006Q1-base:1.1 pkgsrc-2005Q4:1.1.0.20 pkgsrc-2005Q4-base:1.1 pkgsrc-2005Q3:1.1.0.18 pkgsrc-2005Q3-base:1.1 pkgsrc-2005Q2:1.1.0.16 pkgsrc-2005Q2-base:1.1 pkgsrc-2005Q1:1.1.0.14 pkgsrc-2005Q1-base:1.1 pkgsrc-2004Q4:1.1.0.12 pkgsrc-2004Q4-base:1.1 pkgsrc-2004Q3:1.1.0.10 pkgsrc-2004Q3-base:1.1 pkgsrc-2004Q2:1.1.0.8 pkgsrc-2004Q2-base:1.1 pkgsrc-2004Q1:1.1.0.6 pkgsrc-2004Q1-base:1.1 pkgsrc-2003Q4:1.1.0.4 pkgsrc-2003Q4-base:1.1 netbsd-1-6-1:1.1.0.2 netbsd-1-6-1-base:1.1; locks; strict; comment @# @; 1.2 date 2009.02.09.21.09.21; author joerg; state dead; branches; next 1.1; 1.1 date 2003.01.22.17.05.33; author drochner; state Exp; branches; next ; desc @@ 1.2 log @Remove Python 2.1 support. @ text @$NetBSD: patch-ah,v 1.1 2003/01/22 17:05:33 drochner Exp $ --- Lib/os.py.orig Wed Jan 22 17:27:56 2003 +++ Lib/os.py Wed Jan 22 17:30:02 2003 @@@@ -291,7 +291,7 @@@@ _execvpe(file, args) def execvpe(file, args, env): - """execv(file, args, env) + """execvpe(file, args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env , replacing the @@@@ -301,8 +301,9 @@@@ __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) -_notfound = None def _execvpe(file, args, env=None): + from errno import ENOENT, ENOTDIR + if env is not None: func = execve argrest = (args, env) @@@@ -310,7 +311,7 @@@@ func = execv argrest = (args,) env = environ - global _notfound + head, tail = path.split(file) if head: apply(func, (file,) + argrest) @@@@ -320,30 +321,21 @@@@ 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 + saved_exc = None + saved_tb = None 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 - + 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: @ 1.1 log @security fix: don't use guessable temp file names in execvpe() @ text @d1 1 a1 1 $NetBSD$ @