Skip to content
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

Closed
rgheck mannequin opened this issue Aug 3, 2007 · 4 comments
Closed

os.chmod failure #45272

rgheck mannequin opened this issue Aug 3, 2007 · 4 comments

Comments

@rgheck
Copy link
Mannequin

rgheck mannequin commented Aug 3, 2007

BPO 1767242
Nosy @birkenfeld

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:

assignee = None
closed_at = <Date 2007-09-07.07:40:37.277>
created_at = <Date 2007-08-03.18:02:26.000>
labels = []
title = 'os.chmod failure'
updated_at = <Date 2007-09-07.07:40:37.276>
user = 'https://bugs.python.org/rgheck'

bugs.python.org fields:

activity = <Date 2007-09-07.07:40:37.276>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2007-09-07.07:40:37.277>
closer = 'georg.brandl'
components = ['None']
creation = <Date 2007-08-03.18:02:26.000>
creator = 'rgheck'
dependencies = []
files = []
hgrepos = []
issue_num = 1767242
keywords = []
message_count = 4.0
messages = ['32580', '32581', '32582', '32583']
nosy_count = 3.0
nosy_names = ['nnorwitz', 'georg.brandl', 'rgheck']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1767242'
versions = []

Linked PRs

@rgheck
Copy link
Mannequin Author

rgheck mannequin commented Aug 3, 2007

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'.

@birkenfeld
Copy link
Member

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

@rgheck
Copy link
Mannequin Author

rgheck mannequin commented Aug 3, 2007

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.

@nnorwitz
Copy link
Mannequin

nnorwitz mannequin commented Aug 7, 2007

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
FFY00 added a commit to FFY00/cpython that referenced this issue Nov 17, 2024
FFY00 added a commit to FFY00/cpython that referenced this issue Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant