[ python-Bugs-1767242 ] os.chmod failure

SourceForge.net noreply at sourceforge.net
Tue Aug 7 07:45:41 CEST 2007


Bugs item #1767242, was opened at 2007-08-03 11:02
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1767242&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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Richard Heck (rgheck)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.chmod failure

Initial Comment:
When running on Linux and accessing a FAT partition, os.chmod fails with otherwise sensible partitions:
>>> os.chmod("/media/IHP-100/Test.lyx", 400)
>>> os.chmod("/media/IHP-100/Test.lyx", 600)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 1] Operation not permitted: '/media/IHP-100/Test.lyx'
The only thing that seems to be allowed is `4'. 


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-08-06 22:45

Message:
Logged In: YES 
user_id=33168
Originator: NO

Note:  you are *not* using octal in python, but the chmod program is using
octal:

Try prefixing 400/600 with a zero, ie:  0400 or 0600.

----------------------------------------------------------------------

Comment By: Richard Heck (rgheck)
Date: 2007-08-03 13:39

Message:
Logged In: YES 
user_id=1072146
Originator: YES

Well, the shell's chmod doesn't return an error.

[rgheck at rghstudy scripts]$ chmod 600 /media/IHP-100/Test.lyx
[rgheck at rghstudy scripts]$ echo $?
0
[rgheck at rghstudy scripts]$ chmod 400 /media/IHP-100/Test.lyx
[rgheck at rghstudy scripts]$ echo $?
0
[rgheck at rghstudy scripts]$ chmod 700 /media/IHP-100/Test.lyx
[rgheck at rghstudy scripts]$ echo $?
0
[rgheck at rghstudy scripts]$ python
Python 2.4.4 (#1, Oct 23 2006, 13:58:00)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.chmod("/media/IHP-100/Test.lyx", 400)
>>> os.chmod("/media/IHP-100/Test.lyx", 600)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 1] Operation not permitted: '/media/IHP-100/Test.lyx'

I don't know what would happen in C, say.

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2007-08-03 13:25

Message:
Logged In: YES 
user_id=849994
Originator: NO

Why do you think this is Python's fault? os.chmod() is only a very thin
wrapper around the OS' chmod().

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1767242&group_id=5470


More information about the Python-bugs-list mailing list