[Python-bugs-list] [ python-Bugs-539942 ] os.mkdir() handles SETGID inconsistently
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 18 Apr 2002 10:40:23 -0700
Bugs item #539942, was opened at 2002-04-05 14:31
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=539942&group_id=5470
Category: Python Library
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Les Niles (lniles)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.mkdir() handles SETGID inconsistently
Initial Comment:
Under FreeBSD 4.4, with the 2.1.2, 2.1.1 or 1.5.2
library, os.mkdir() does NOT set the SETGID or SETUID
bits, regardless of whether they're specified in the
mode argument to os.mkdir(). The bits can be set via
a call to os.chmod(). This behavior appears to be
inherited from FreeBSD's mkdir() os call. On Linux,
the SETGID/SETUID bits are set via os.mkdir()'s mode
argument. (As near as I can tell, POSIX.1 specifies
yet a different behavior.) This is a bug from the
standpoint of Python's os module providing a uniform
interface.
----------------------------------------------------------------------
>Comment By: Barry Warsaw (bwarsaw)
Date: 2002-04-18 13:40
Message:
Logged In: YES
user_id=12800
It's also quite inconvenient for cross platform portability
because now you have to either always call os.chmod()
everytime you call os.mkdir(), or replace os.mkdir() with a
function that does that (so all call sites, even in library
modules actually DTRT).
IWBNI Python's default os.mkdir() provided that cross
platform compatibility.
----------------------------------------------------------------------
Comment By: Dan Grassi (dgrassi)
Date: 2002-04-18 12:08
Message:
Logged In: YES
user_id=366473
On Mac OS X which is also a BSD derivative the mode argument to mkdir()is completely ignored. This becomes more of an issue when makedirs() is used because a simple chmod (which does work) is not sufficient if multiple directories were created.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-04-05 18:50
Message:
Logged In: YES
user_id=21627
This is not a bug. The posix module exposes functions from
the OS as-is, not trying to unify them. The os module
re-exposes those functions where available. Minor details of
the behaviour of those functions across platforms are
acceptable. For example, on Windows, os.mkdir does not set
any bits. Instead, ACLs are inherited according to the OS
semantics (i.e. it does on NTFS, but doesn't on FAT32).
If you need a function that makes certain additional
guarantees, write a new function.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=539942&group_id=5470