-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os.chmod failure #45272
Comments
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'. |
Why do you think this is Python's fault? os.chmod() is only a very thin wrapper around the OS' chmod(). |
Well, the shell's chmod doesn't return an error. [rgheck@rghstudy scripts]$ chmod 600 /media/IHP-100/Test.lyx
[rgheck@rghstudy scripts]$ echo $?
0
[rgheck@rghstudy scripts]$ chmod 400 /media/IHP-100/Test.lyx
[rgheck@rghstudy scripts]$ echo $?
0
[rgheck@rghstudy scripts]$ chmod 700 /media/IHP-100/Test.lyx
[rgheck@rghstudy scripts]$ echo $?
0
[rgheck@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. |
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. |
FFY00
added a commit
to FFY00/cpython
that referenced
this issue
Nov 17, 2024
Signed-off-by: Filipe Laíns <[email protected]>
FFY00
added a commit
to FFY00/cpython
that referenced
this issue
Nov 17, 2024
Signed-off-by: Filipe Laíns <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: