<p>There was a suggestion on the issue tracker that it might be better to add an optional argument to shutil.move rather than create a new function. Does anyone have any comments or suggestions about this?</p>
<div class="gmail_quote">On Aug 12, 2011 7:35 PM, "David Townshend" <<a href="mailto:aquavitae69@gmail.com">aquavitae69@gmail.com</a>> wrote:<br type="attribution">> If the kernel doesn't allow file locking then I don't see any way that a<br>
> locking context manager will be possible, but it should still be possible to<br>> safely move files using link and unlink. Maybe the other problem functions<br>> can be dealt with individually in a similar way?<br>
> On Aug 12, 2011 6:57 PM, "Christian Heimes" <<a href="mailto:lists@cheimes.de">lists@cheimes.de</a>> wrote:<br>>> Am 12.08.2011 18:37, schrieb Masklinn:<br>>>> On 2011-08-12, at 17:03 , Christian Heimes wrote:<br>
>>>> Am 12.08.2011 16:55, schrieb Masklinn:<br>>>>>> On 2011-08-12, at 16:48 , David Townshend wrote:<br>>>>>>> My understanding of os.O_EXCL is that it locks the file from changes<br>
> by any<br>>>>>>> other process.<br>>>>>> That, *could* be O_EXLOCK, but I'm not too sure.<br>>>>>><br>>>>>> O_EXCL does not do anything in and of itself, it fails the file opening<br>
> if combined with O_CREAT. That's it (from man 2 open):<br>>>>>><br>>>>>> O_EXCL error if O_CREAT and the file exists<br>>>>><br>>>>> The man page open(2) doesn't mention O_EXLOCK. It must belong to another<br>
>>>> low level function.<br>>>> Nope, got it from open(2), but it's apparently a bsd extension:<br>> <a href="http://lkml.indiana.edu/hypermail/linux/kernel/0005.1/1288.html">http://lkml.indiana.edu/hypermail/linux/kernel/0005.1/1288.html</a><br>
>>><br>>>> This information (that it's an extension) is present in the OpenBSD<br>> open(2) page, but I checked it on an OSX machine where it's not specified.<br>> Sorry.<br>>>><br>
>>> It's an atomic `flock(fd, LOCK_EX)` (or LOCK_SH) built into open(2) to<br>> avoid the unlocked open hole between the open(2) and flock(2) calls.<br>>><br>>> Ah, I've checked the open(2) man page on Linux. Should have mentioned<br>
>> the OS ... sorry, too.<br>>><br>>> Anyway flock()s are only advisory (cooperative) locks and not mandatory<br>>> locks. Although some Unices have support for mandatory locks, they can<br>>> be circumvented with unlink().<br>
>><br>>> Christian<br>>> _______________________________________________<br>>> Python-ideas mailing list<br>>> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>>> <a href="http://mail.python.org/mailman/listinfo/python-ideas">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div>