[3.6] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523)#10068
Conversation
…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>
|
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. |
This change basically copy/paste the doc in Doc/library/shutil.rst. "On Linux ..." is the second sentence:
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. |
|
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. |


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