Issue755617
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003-06-17 00:13 by mshomphe, last changed 2022-04-10 16:09 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
os.chmod.thread.txt | mshomphe, 2003-06-17 00:13 | Email thread discussing os.chmod() | ||
os.chmod.txt | mshomphe, 2003-06-17 02:05 |
Messages (12) | |||
---|---|---|---|
msg16441 - (view) | Author: Matthew Shomphe (mshomphe) | Date: 2003-06-17 00:13 | |
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. |
|||
msg16442 - (view) | Author: Neal Norwitz (nnorwitz) * ![]() |
Date: 2003-06-17 01:06 | |
Logged In: YES user_id=33168 Could you try to produce a patch to improve the documentation? Or perhaps suggest better wording? |
|||
msg16443 - (view) | Author: Matthew Shomphe (mshomphe) | Date: 2003-06-17 02:05 | |
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@ |
|||
msg16444 - (view) | Author: Grant Olson (logistix) | Date: 2003-06-17 02:51 | |
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> |
|||
msg16445 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2003-06-17 03:28 | |
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. |
|||
msg16446 - (view) | Author: Christopher Blunck (blunck2) | Date: 2003-06-17 03:37 | |
Logged In: YES user_id=531881 see patch 755677 sheesh neal, you couldn't patch this? ;-) |
|||
msg16447 - (view) | Author: Grant Olson (logistix) | Date: 2003-06-17 05:35 | |
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) |
|||
msg16448 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2003-06-17 14:49 | |
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). |
|||
msg16449 - (view) | Author: Christopher Blunck (blunck2) | Date: 2003-06-17 15:18 | |
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 |
|||
msg16450 - (view) | Author: Grant Olson (logistix) | Date: 2003-06-17 19:31 | |
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. |
|||
msg16451 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2005-06-05 18:28 | |
Logged In: YES user_id=1188172 I think the wording suggested by logistix would be a good addition to the docs. |
|||
msg16452 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2005-07-18 08:17 | |
Logged In: YES user_id=1188172 Added this note to the chmod docs: Although Windows supports chmod, you can only set the file's read-only flag with this function (via the \code{S_IWRITE} and \code{S_IREAD} constants or a corresponding integer value). All other bits are ignored. Doc/lib/libos.tex r1.164, r1.146.2.10. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:09:15 | admin | set | github: 38661 |
2003-06-17 00:13:09 | mshomphe | create |