This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: shutil.copy2 is not the same as cp -p
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: csernazs, giampaolo.rodola, vstinner
Priority: normal Keywords: patch

Created on 2018-07-28 12:43 by csernazs, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8523 merged python-dev, 2018-07-28 12:56
PR 10068 merged csernazs, 2018-10-23 19:32
PR 10071 merged csernazs, 2018-10-23 19:46
PR 10065 merged csernazs, 2018-10-23 21:57
Messages (7)
msg322551 - (view) Author: Zsolt Cserna (csernazs) * Date: 2018-07-28 12:43
The docstring of shutil.copy2 says the following:

Copy data and all stat info ("cp -p src dst").

This can be misleading as it is not the same as 'cp -p', as it does not copy the file owner (uid and gid). That would need to have a chown() call to be made, which is currently not called unavailable.

I would like to have the documentation fixed by adding that it does not copies file owner and group.
msg328297 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-23 10:09
New changeset 4f399be0e70d8b5516b6213568b7665765bb3114 by Victor Stinner (Zsolt Cserna) in branch 'master':
bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523)
https://github.com/python/cpython/commit/4f399be0e70d8b5516b6213568b7665765bb3114
msg328348 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-23 21:58
New changeset 861f61b5a93d178e913ad3c760d529ee3155e66d by Victor Stinner (Zsolt Cserna) in branch '3.7':
[3.7] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523) (GH-10065)
https://github.com/python/cpython/commit/861f61b5a93d178e913ad3c760d529ee3155e66d
msg328349 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-23 21:58
New changeset 797cfbd69e3484ecf25f5acf75b06691e3fc97fa by Victor Stinner (Zsolt Cserna) in branch '3.6':
[3.6] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523) (GH-10068)
https://github.com/python/cpython/commit/797cfbd69e3484ecf25f5acf75b06691e3fc97fa
msg328394 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-24 21:22
New changeset 4a59c9699ca8688359c460f98127a12e2db6e63b by Victor Stinner (Zsolt Cserna) in branch '2.7':
[2.7] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523) (GH-10071)
https://github.com/python/cpython/commit/4a59c9699ca8688359c460f98127a12e2db6e63b
msg328395 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-24 21:23
Thanks Zsolt Cserna for the report and for the documentation enhancements! The doc is now way better.
msg328414 - (view) Author: Zsolt Cserna (csernazs) * Date: 2018-10-25 06:52
Thanks for your help! :)
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78441
2018-10-25 06:52:09csernazssetmessages: + msg328414
2018-10-24 21:23:19vstinnersetstatus: open -> closed
versions: + Python 2.7
messages: + msg328395

resolution: fixed
stage: patch review -> resolved
2018-10-24 21:22:35vstinnersetmessages: + msg328394
2018-10-23 21:58:15vstinnersetmessages: + msg328349
2018-10-23 21:58:00vstinnersetmessages: + msg328348
2018-10-23 21:57:06csernazssetpull_requests: + pull_request9405
2018-10-23 19:46:28csernazssetpull_requests: + pull_request9404
2018-10-23 19:32:23csernazssetpull_requests: + pull_request9401
2018-10-23 10:09:54vstinnersetnosy: + vstinner
messages: + msg328297
2018-07-28 12:56:05python-devsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8041
2018-07-28 12:48:30giampaolo.rodolasetnosy: + giampaolo.rodola
2018-07-28 12:43:01csernazscreate