Issue 1355826: shutil.move() does not preserve ownership (original) (raw)

Issue1355826

Created on 2005-11-13 10:14 by sprif, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg60836 - (view) Author: lightweight (sprif) Date: 2005-11-13 10:14
shutil.move() does not preserve file and directory ownership when moving a whole directory tree to a different filesystem. This does not happen when shutil.move() is used to move a directory tree within the same filesystem. Version: python 2.4.2 I have had a look at the source code in shutil.py and noticed that shutil.copystat() does not copy the ownership information, whereas "stat" command does output information about the ownership (on GNU/Linux at least). The only discussion I found refering to file / directory ownership and possible security implications (if any) can be found here: http://mail.python.org/pipermail/python-bugs-list/2004-November/025985.html
msg83019 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2009-03-02 13:27
While this is surprising, this is documented behavior: "If the destination is on the current filesystem, then simply use rename. Otherwise, copy src (with copy2()) to the dst and then remove src." And copy2() uses copystat() and does not copy "contents, owner, and group".
msg103688 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-04-20 09:30
That's because there's no simple, portable way to copy all metadata. If you need to copy all of them you will need to use OS-specific APIs
History
Date User Action Args
2022-04-11 14:56:14 admin set github: 42586
2010-04-20 09:30:19 tarek set status: open -> closednosy: + tarekmessages: + assignee: tarekresolution: wont fix
2009-04-22 14:39:20 ajaksu2 set keywords: + easystage: test needed
2009-03-20 23:31:23 ajaksu2 link issue1368091 superseder
2009-03-02 13:27:26 aronacher set nosy: + aronachermessages: +
2009-03-01 05:32:38 akitada set type: enhancementversions: + Python 2.6, Python 3.0, Python 3.1, Python 2.7, - Python 2.4
2005-11-13 10:14:17 sprif create