Visitar URL original
[3.6] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523) by csernazs · Pull Request #10068 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260615010412/https://github.com/python/cpython/pull/10068
Skip to content
/ cpython Public

[3.6] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523)#10068

Merged
vstinner merged 1 commit into
python:3.6from
csernazs:backport-4f399be-3.6
Oct 23, 2018
Merged

[3.6] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523)#10068
vstinner merged 1 commit into
python:3.6from
csernazs:backport-4f399be-3.6

Conversation

@csernazs

@csernazs csernazs commented Oct 23, 2018 •

Copy link
Copy Markdown
Contributor

Fix the documentation of copy2, as it does not copy file ownership (user and
group), only mode, mtime, atime and flags.

The original text was confusing to developers as it suggested that this
command is the same as 'cp -p', but according to cp(1), '-p' copies file
ownership as well.

Clarify which metadata is copied by shutil.copystat in its docstring..
(cherry picked from commit 4f399be)

Co-authored-by: Zsolt Cserna cserna.zsolt@gmail.com

https://bugs.python.org/issue34260

…GH-8523)

Fix the documentation of copy2, as it does not copy file ownership (user and
group), only mode, mtime, atime and flags.

The original text was confusing to developers as it suggested that this
command is the same as 'cp -p', but according to cp(1), '-p' copies file
ownership as well.

Clarify which metadata is copied by shutil.copystat in its docstring..
(cherry picked from commit 4f399be)

Co-authored-by: Zsolt Cserna <cserna.zsolt@gmail.com>
@aixtools

aixtools commented Oct 23, 2018 •

Copy link
Copy Markdown
Contributor

I realize this is already merged in master. But I am surprised there is "documentation" included for "On Linux" while nothing is included/said about other platforms.

I would expect the """ text """ comments in code to be platform independent - with platform comments re: differences to be placed in the "Documentation" area.

IMHO - putting platform information here - in the code - unless it is intended as an accepted exception to the general behavior - leads to other platforms to to feel they also need to add "something special" to be equivalent to this accepted exception. But, it is unclear, at this point, what the intended behavior for all platforms should be.

IMHO, If it is not an exception no platform should be mentioned - AND if it constitutes a change from what was accepted behavior - a test should be added to establish that all platforms are, or cannot, meet the new expectations.

@vstinner

Copy link
Copy Markdown
Member

But I am surprised there is "documentation" included for "On Linux" ...

This change basically copy/paste the doc in Doc/library/shutil.rst. "On Linux ..." is the second sentence:
https://docs.python.org/dev/library/shutil.html#shutil.copystat

... while nothing is included/said about other platforms.

Probably because there is nothing to say or because nobody came up with a PR to document the behavior on other platforms.

Technically, I don't see any code specific to Linux in shutil.py. I guess that the documentation is specific to Linux because when the doc has been written, os.chflags() was specific to Linux?

More generally, a backport PR is not the best place to discuss the doc, since this PR is going to be closed quickly :-) Open a new issue if you would like to enhance the doc.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@aixtools

Copy link
Copy Markdown
Contributor

Understood. I anticipated that this was not the best place to comment as "I realize this is already merged in master".

Maybe I'll have time to respond in a more timely manner next time. I would not have any idea on how to correct this - as I have no way to test all platforms.

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants