[Ironpython-users] Missing os.getuid()

Jeff Hardy jdhardy at gmail.com
Mon Feb 10 11:56:49 CET 2014


On Fri, Feb 7, 2014 at 1:45 PM, Doug Blank <doug.blank at gmail.com> wrote:
> I'm trying to figure out if the missing os.getuid() is a bug in IronPython.
>
> On the one hand, this is to be defined for Unix, where os.name == "posix"
> (when running IronPython on Unix).  On the other hand, what should it return
> when sys.platform == "cli" and os.name == "nt"?

On CPython getuid simply doesn't exist if os.name == 'nt'. Seems like
the proper way to go. Arguably the POSIX stuff should not be in 'os',
but that ship has long sailed. :)

>
> It seems that many programs in the wild will check to see if os.name is
> "posix", and if it is, then it assumes all functions valid for Unix will be
> available.
>
> What is IronPython's strategy for situations like this?

Cry :(

Right now IronPython doesn't have a posix module, it just has an nt
module, and renames 'nt' to 'posix' when running on Mono. This is fine
for 90% of the APIs.

The proper fix would be to create a class containing all of the common
stuff implemented using the core .NET APIs (or, more accurately, the
PAL that wraps those APIs), and then separate 'posix' and 'nt' modules
that implement the OS-specific parts using Mono.Posix or P/Invoke.
It's not a huge amount of work but it's enough that it hasn't been
done yet.

- Jeff


More information about the Ironpython-users mailing list