[issue1076515] shutil.move clobbers read-only files.
Brett Cannon added the comment: Closing since everyone seems to agree that the current behaviour is fine and Tarek has not said anything since being assigned the bug. -- nosy: +brett.cannon resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
R. David Murray added the comment: Since I spent some time thinking about this, I want to leave some notes: The linux 'mv' command issues the following prompt: mv t2/myfile t1 mv: try to overwrite ‘t1/myfile’, overriding mode (-)? So modern linux, at least, will not overwrite the file unless the '-f' flag is given explicitly (or you answer yes to the prompt, but that's not relevant to shutil.move). However, shutil.move does not claim to implement 'mv'. The release note in 3.3 indicates we've adapted its symlink handling to mimic mv, but the rest of the text is explicit about the implementation *in terms of other stdlib functions*. So really the only way to understand the behavior of shutil.move is to understand what those other functions do on your platform. The OP's confusion had to do with the behavior of *the Unix file system* in the face of a rename operation, not with the definition of shutil.move itself (which says that it uses rename, and links to its description). Someone could think through the description of 'rename' and open an issue to improve *its* documentation if that seems warranted, but I think that has permission is somewhat platform dependent and so it probably isn't appropriate to change that doc, either. Thus, I agree that this should be closed. -- nosy: +r.david.murray resolution: rejected - invalid stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Greg Roodt gro...@gmail.com added the comment: I can add some more info to the docs if anybody feels they are required, but I think they are sufficient. It already mentions that it copies file contents and that the correct permissions are required. This is mentioned in the docs for shutil.copyfile: The destination location must be writable; otherwise, an OSError exception will be raised. If dst already exists, it will be replaced. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Greg Roodt gro...@gmail.com added the comment: I believe this can be closed. shutil.copyfile attempts to copy file contents from src to dst, so it makes sense for this to fail if dst is read-only. shutil.move replaces the dst, which is permitted based on directory permissions. -- nosy: +groodt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Éric Araujo mer...@netwok.org added the comment: Would a doc clarification be useful? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Changes by Antoine Pitrou pit...@free.fr: -- stage: unit test needed - type: behavior - feature request versions: -Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Mark Lawrence breamore...@yahoo.co.uk added the comment: No reply to msg114985. -- resolution: - invalid status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Brian Curtin cur...@acm.org added the comment: I haven't had time to investigate but it shouldn't be closed just yet. Someone will get to it. -- resolution: invalid - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Mark Lawrence breamore...@yahoo.co.uk added the comment: Brian, Tim, any comments on this wrt Windows or do you think this can be closed? Could there be an impact on any other OS? I'll close if there's no response, unless someone else feels fit to close this anyway. -- nosy: +BreamoreBoy, brian.curtin, tim.golden status: open - pending versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Brian Brazil brian.bra...@gmail.com added the comment: Here's a quick test: Python 3.2a1+ (py3k:83811, Aug 8 2010, 09:00:22) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2 Type help, copyright, credits or license for more information. import os, shutil open('a', 'w').write('a') 1 open('b', 'w').write('b') 1 os.chmod('b', 000) shutil.move('a', 'b') open('b').read() 'a' This is the correct behaviour on Unix, so I'd say this can be closed off. -- nosy: +bbrazil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Éric Araujo mer...@netwok.org added the comment: Is this bug still relevant? -- assignee: - tarek nosy: +merwok, tarek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Changes by Daniel Diniz aja...@gmail.com: -- keywords: +easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1076515] shutil.move clobbers read-only files.
Changes by Daniel Diniz aja...@gmail.com: -- dependencies: +shutil.copyfile fails when dst exists read-only stage: - test needed type: - behavior versions: +Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1076515 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com