Title: Update os.samefile docstring to match documentation
Type: behavior Stage: patch review
Components: Documentation Versions: Python 3.8, Python 3.7, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eMPee584, r.david.murray, steve.dower
Priority: normal Keywords: patch

Created on 2017-07-20 08:07 by eMPee584, last changed 2018-07-28 12:56 by steve.dower.

Pull Requests
URL Status Linked Edit
PR 7337 open tuxtimo, 2018-06-02 11:58
Messages (4)
msg298708 - (view) Author: Marcel Partap (eMPee584) Date: 2017-07-20 08:07
Don't know whether it should be considered a documentation or behavioral issue, but os.samefile calls os.stat() on given files, following symlinks. Does this really "test whether two pathnames reference the same actual file"? I'd consider os.lstat() more suited for that.

This bites me every time I want to overwrite a symlink with its referenced file using ranger.
msg298731 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-20 15:47
I would take "actual file" as meaning the file the symlink points to, so I'd say the documentation matches the implementation according to your description of the two.  The current docs actually say "refer to the same file or directory", and mention os.stat explicitly, so again I'd say the docs and implementation match.

It sounds like what you want is to open a feature request for a samefile equivalent that does not follow symlinks.  lsamefile?

We could use this issue for making the docstring match the docs, though.  I think the sentence in the docs is short enough to just get copied into the docstring.
msg322555 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-07-28 12:56
I think the docs are too specific about the mechanism used here - if we document *how* it works then we may not be able to make it work correctly (with a different mechanic) on a different platform.
msg322556 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-07-28 12:56
Sorry, I meant the docs after the patch. Before, it's fine.
Date User Action Args
2018-07-28 12:56:59steve.dowersetkeywords: - easy
2018-07-28 12:56:47steve.dowersetmessages: + msg322556
2018-07-28 12:56:35steve.dowersetnosy: + steve.dower
messages: + msg322555
2018-06-02 11:58:23tuxtimosetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request6968
2018-03-04 22:06:32cheryl.sabellasetkeywords: + easy
stage: needs patch
versions: + Python 3.8, - Python 3.6
2017-07-20 15:47:15r.david.murraysetassignee: docs@python

components: + Documentation
title: os.samefile / shutil._samefile: following symlinks -> Update os.samefile docstring to match documentation
nosy: + docs@python, r.david.murray
versions: + Python 3.6, Python 3.7
messages: + msg298731
2017-07-20 08:07:10eMPee584create