[issue1076515] shutil.move clobbers read-only files.

2013-03-10 Thread R. David Murray

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 

___
___
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.

2013-03-10 Thread Brett Cannon

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 

___
___
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.

2012-07-09 Thread Greg Roodt

Greg Roodt  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 

___
___
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.

2012-07-07 Thread Éric Araujo

Éric Araujo  added the comment:

Would a doc clarification be useful?

--

___
Python tracker 

___
___
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.

2012-07-07 Thread Greg Roodt

Greg Roodt  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 

___
___
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.

2010-09-13 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage: unit test needed -> 
type: behavior -> feature request
versions:  -Python 2.7, Python 3.1

___
Python tracker 

___
___
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.

2010-09-13 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I agree that this follows Unix behaviour: a read-only file is a file whose 
contents cannot be modified, but you can replace it with another totally 
different file. You can also delete it, by the way (*).

Also, even if this weren't the desired behaviour, changing it would break 
compatibility for existing scripts.

(*)

>>> open('b', 'w').write('b')
1
>>> os.chmod('b', 000)
>>> os.remove('b')
>>> open('b', 'r')
Traceback (most recent call last):
  File "", line 1, in 
IOError: [Errno 2] No such file or directory: 'b'

--
nosy: +pitrou

___
Python tracker 

___
___
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.

2010-09-12 Thread Brian Curtin

Brian Curtin  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 

___
___
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.

2010-09-12 Thread Mark Lawrence

Mark Lawrence  added the comment:

No reply to msg114985.

--
resolution:  -> invalid
status: pending -> closed

___
Python tracker 

___
___
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.

2010-08-26 Thread Mark Lawrence

Mark Lawrence  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 

___
___
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.

2010-08-08 Thread Brian Brazil

Brian Brazil  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 

___
___
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.

2010-06-12 Thread Éric Araujo

Éric Araujo  added the comment:

Is this bug still relevant?

--
assignee:  -> tarek
nosy: +merwok, tarek

___
Python tracker 

___
___
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.

2009-04-21 Thread Daniel Diniz

Changes by Daniel Diniz :


--
keywords: +easy

___
Python tracker 

___
___
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.

2009-03-30 Thread Daniel Diniz

Changes by Daniel Diniz :


--
dependencies: +shutil.copyfile fails when dst exists read-only
stage:  -> test needed
type:  -> behavior
versions: +Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com