2.4->2.5 current directory change?

Ziga Seilnacht ziga.seilnacht at gmail.com
Mon Feb 26 16:56:26 EST 2007


Chris Mellon wrote:
> Considering that it's a backwards incompatible breaking change
> (although I understand why it was done), you'd think it deserved
> mention in the more prominent "Whats new in Python 2.5" section on the
> website, in addition to a one-liner in the NEWS file. Ah well, while
> I'm sure I'm not the only one who ran into it, it doesn't seem to be
> causing mass calamity and I know now.

I guess that most of the scripts that want curdir on path and work
on different platforms already have to include current directory
manualy. Twisted's preamble in Trial does that too, but it is too
cautious to work on Windows (line 15 in the trial script):

if hasattr(os, "getuid") and os.getuid() != 0:
    sys.path.insert(0, os.curdir)

Maybe that can be changed to:

if not hasattr(os, "getuid") or os.getuid() != 0:
    sys.path.insert(0, os.curdir)

I'm no security expert, and I don't know if there are other
operating systems that don't have getuid() function but have
a superuser, but this doesn't look that less secure to me.

Ziga




More information about the Python-list mailing list