python / cpython

The Python programming language
https://www.python.org
Other
62.92k stars 30.14k forks source link

os.lchmod is not present #51728

Closed 4b9e930a-d55e-4da6-95fc-cea7e83e2bfb closed 14 years ago

4b9e930a-d55e-4da6-95fc-cea7e83e2bfb commented 14 years ago
BPO 7479
Nosy @loewis, @birkenfeld, @pitrou, @bitdancer, @barneygale
PRs
  • python/cpython#18864
  • 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: ```python assignee = 'https://github.com/birkenfeld' closed_at = created_at = labels = ['type-bug', 'docs'] title = 'os.lchmod is not present' updated_at = user = 'https://bugs.python.org/bluegeek' ``` bugs.python.org fields: ```python activity = actor = 'barneygale' assignee = 'georg.brandl' closed = True closed_date = closer = 'georg.brandl' components = ['Documentation'] creation = creator = 'bluegeek' dependencies = [] files = [] hgrepos = [] issue_num = 7479 keywords = [] message_count = 9.0 messages = ['96249', '96252', '96279', '96280', '96288', '96289', '96299', '96309', '96633'] nosy_count = 6.0 nosy_names = ['loewis', 'georg.brandl', 'pitrou', 'r.david.murray', 'bluegeek', 'barneygale'] pr_nums = ['18864'] priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue7479' versions = ['Python 2.6'] ```

    4b9e930a-d55e-4da6-95fc-cea7e83e2bfb commented 14 years ago

    Reason for opening this bug: \============================ I am opening a bug because the documentation here: http://docs.python.org/library/os.html#os.lchmod

    Says that in python 2.6 there is a method os.lchmod() for changing the permissions of unix symbolic links,

    I am running Python 2.6 on several flavors of Linux, and non of them have os.lchmod(). My understanding is that one can not change the permissions of a sybolic link on Linux because the symlink basically 'inherits' the permissions of the file if points to.

    Is this ment to be used on other flavors of UNIX other than Linux?

    I am only really familiar with Linux, and have not played with man y other flavors on UNIX. Can other flavor change the permission of symbolic links?

    What I am Looking for from this bug report: \=========================================== I would like to know what is happening with os.lchmod. If it is not suppose to be there, I would like it removed from the documentation. If it is mena for other flavors of unix, but not linux. I think it should be implemented as just a function that passes.

    Let me know what you think.

    Peace, Steve

    pitrou commented 14 years ago

    lchmod seems to be a BSD-specific function.

    61337411-43fc-4a9c-b8d5-4060aede66d0 commented 14 years ago

    All functions in the POSIX/os module are available only on those systems that support them, and then do exactly what the system says they should do. So if your system doesn't have lchmod, the os module won't provide such a function on your system. There are systems which do provide lchmod, e.g. NetBSD 1.3 and later.

    Exposing this as a no-op function on systems which don't implement it would be incorrect. If you want to wrap it with a no-op function in your application, go ahead - it's easy enough.

    I fail to see a bug in this report, so closing it as invalid.

    bitdancer commented 14 years ago

    Perhaps the bug is a small documentation bug, in that it should be "Availability: BSD-based unix"? We don't seem to have any other examples of doing that in the docs, though.

    birkenfeld commented 14 years ago

    I don't see why we can't start it. I'd prefer "Some Unices" though, since you never know when e.g. Linux is going to start supporting e.g. lchmod().

    61337411-43fc-4a9c-b8d5-4060aede66d0 commented 14 years ago

    If we do that, we would probably need to acknowledge that most functions in the POSIX module are available only on some Unixes - namely all that are listed in posix_methods with conditional compilation. That, in turn, would be silly for things like getcwd where probably only minority systems (e.g. embedded systems without file system) fail to support it.

    I think the problem of this report really originates in the unfamiliarity of the OP with Unix implementations other than Linux, rather than in a flaw of the Python documentation.

    pitrou commented 14 years ago

    Perhaps the top-level module description should just be clearer. Right now it is not obvious that functions marked "availability: Unix" may only be available on certain Unix flavours.

    4b9e930a-d55e-4da6-95fc-cea7e83e2bfb commented 14 years ago

    Thank you for you explanation of os.lchmod()

    Adding a note to the documentation would be very useful. I did search the internet for an answer before posting the bug, and I was only able to find forum posts of other people having the same issue.

    Thank you again, peace; Steve,

    birkenfeld commented 14 years ago

    Added such a note in r76891.