Bugs item #755617, was opened at 2003-06-17 02:13 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=755617&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: Matthew Shomphe (mshomphe) Assigned to: Nobody/Anonymous (nobody) Summary: os module: Need a better description of "mode" Initial Comment: The page <http://www.python. org/doc/current/lib/os-file-dir.html> says the following about the function os.chmod: chmod(path, mode) Change the mode of path to the numeric mode. Availability: Unix, Windows. The "mode" values are unclear. It turns out that the UNIX file permission set (e.g., 0666 for read/writeable) works with the Windows set (where 0666 translates to 33206). Is it possible to describe the file permissions in more detail in the documentation at this point? Attached is an email thread discussing this documentation issue. ---------------------------------------------------------------------- >Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-06-05 20:28 Message: Logged In: YES user_id=1188172 I think the wording suggested by logistix would be a good addition to the docs. ---------------------------------------------------------------------- Comment By: logistix (logistix) Date: 2003-06-17 21:31 Message: Logged In: YES user_id=699438 Something like: "NOTE: Although Windows supports chmod, it incorporates much different functionality than a typical Unix user would expect. Please refer to Microsoft’s documentation for more details." would be nice. ---------------------------------------------------------------------- Comment By: Christopher Blunck (blunck2) Date: 2003-06-17 17:18 Message: Logged In: YES user_id=531881 Tim- I captured what Matthew Shomphe recommended into patch 755677 (http://www.python.org/sf/755677). Hope this helps. -c ---------------------------------------------------------------------- Comment By: Tim Peters (tim_one) Date: 2003-06-17 16:49 Message: Logged In: YES user_id=31435 Then please suggest the actual text you want to see in the docs. I can't do it for you (for example, chmod has always done exactly what I've wanted it to do on Windows -- but then I've never wanted to do anything with it on Windows beyond fiddling the readonly bit). ---------------------------------------------------------------------- Comment By: logistix (logistix) Date: 2003-06-17 07:35 Message: Logged In: YES user_id=699438 All I'm saying is that although chmod is valid windows call, it will not produce the effect that most users expect. There's no harm in calling it, but it's not going to accomplish what most users want it to do. This information is more important to a user than other inconsistencies in the Windows implementation. (i.e. os.stat returning a value that is different than chmod set) ---------------------------------------------------------------------- Comment By: Christopher Blunck (blunck2) Date: 2003-06-17 05:37 Message: Logged In: YES user_id=531881 see patch 755677 sheesh neal, you couldn't patch this? ;-) ---------------------------------------------------------------------- Comment By: Tim Peters (tim_one) Date: 2003-06-17 05:28 Message: Logged In: YES user_id=31435 Well, let's not overreact here -- MS's _chmod simply calls the Win32 SetFileAttributes(), and the only thing it can change is the FILE_ATTRIBUTE_READONLY flag. That's all part of Windows base services, and makes sense on FAT too. ---------------------------------------------------------------------- Comment By: logistix (logistix) Date: 2003-06-17 04:51 Message: Logged In: YES user_id=699438 Realistically, you should NEVER intentionally use chmod to set file permissions on Windows. The FAT filesystem has no permissions, and NTFS has ACLs which are much too complex to map to a chmod style call. MS only has chmod support so they can claim some level of posix compliance. I'm not saying you should drop the ability to call os.chmod on windows, but perhaps the docs should say that its not the recommended way of doing things. Unfortunately, there's not a recommended way of setting security that'll work on all Windows platforms either (although I'd start with os.popen ("cacls ...") Even win32security requires some serious programming just to get started with manipulating ACLs. Typical security looks something like this: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\grant>xcacls "\Program files" C:\Program Files BUILTIN\Users:R BUILTIN\Users:(OI)(CI)(IO)(special access:) GENERIC_READ GENERIC_EXECUTE BUILTIN\Power Users:C BUILTIN\Power Users:(OI)(CI)(IO)C BUILTIN\Administrators:F BUILTIN\Administrators:(OI)(CI)(IO)F NT AUTHORITY\SYSTEM:F NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F BUILTIN\Administrators:F CREATOR OWNER:(OI)(CI)(IO)F C:\Documents and Settings\grant> ---------------------------------------------------------------------- Comment By: Matthew Shomphe (mshomphe) Date: 2003-06-17 04:05 Message: Logged In: YES user_id=716326 Here's my first pass at some additional documentation. My HTML skills are not up to par, but I've tried :) I've attached the document separately. m@ ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2003-06-17 03:06 Message: Logged In: YES user_id=33168 Could you try to produce a patch to improve the documentation? Or perhaps suggest better wording? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=755617&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com