[Python-Dev] Weird error handling in os._execvpe
Zack Weinberg
zack@codesourcery.com
Thu, 1 Aug 2002 15:06:41 -0700
On Thu, Aug 01, 2002 at 03:27:43PM -0400, Guido van Rossum wrote:
> > 1. Make os.execvp[e] just call the C library's execvp[e]; it has to
> > get this stuff right anyway. We are already counting on it for
> > execv - I would be surprised to find a system that had execv and
> > not execvp, as long as PATH was a meaningful concept (it isn't, for
> > instance, on classic MacOS).
>
> Probably agreed for execvpe(). All the non-env versions must call the
> env version because not all platforms have putenv, and there changes
> to os.environ don't get reflected in the process's environment.
execvp could be just
def execvp(file, args):
return execvpe(file, args, environ)
yes?
> > 2. Enumerate all the platform-specific errno values for this failure
> > mode, and check them all. On Unix, ENOENT and arguably ENOTDIR. I
> > don't know about others.
> >
> > 3. If we must do the temporary file thing, create a temporary
> > _directory_; we control the contents of that directory, so we can
> > be sure that the file name we choose does not exist. Cleanup is
> > messier than the other two possibilities.
>
> I like to agree with this, but I don't recall exactly why we ended up
> in this situation in the first place. It's possible that it's an
> unnecessary sacrifice of a dead chicken, but it's also possible that
> there are platforms where this addressed a real need. I'd like to
> think that it was because I didn't want to add more cruft to
> posixmodule.c (I've long given up on that :-).
>
> Can you post a patch to SF? Then we can ask for volunteers to test it
> on various platforms.
I will write such a patch, however, I keep getting lost in the Python
source tree. In addition to Modules/posixmodule.c, I would need to
update the nt, dos, os2, mac, ce, and riscos modules also, yes? Where
are their sources kept? I don't see an ntmodule.c, etc anywhere.
zw