[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-18 Thread janzert

janzert added the comment:

Thanks for committing the fix.

Figured I should finally get it done and signed the online CLA when I submitted 
this issue. I assume it just takes a while for someone to go through and apply 
the appropriate flag?

This change seems rather insubstantial for an ACKS line so I certainly don't 
mind waiting. Since a certain Birkenfeld became Brandl I know names are a bit 
sensitive for some python core devs. So while my personal preference would go 
to Janzert* the one that fits Python custom is Brian Haskin.

* Janzert is the most widely used and distinct identifier for my open source 
and online activity.

--

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 68e5e416e8af by R David Murray in branch '3.3':
#19037: adjust file times *before* moving maildir files into place.
http://hg.python.org/cpython/rev/68e5e416e8af

New changeset 041caa64486b by R David Murray in branch '2.7':
#19037: adjust file times *before* moving maildir files into place.
http://hg.python.org/cpython/rev/041caa64486b

New changeset 261910257af6 by R David Murray in branch 'default':
Merge #19037: adjust file times *before* moving maildir files into place.
http://hg.python.org/cpython/rev/261910257af6

--
nosy: +python-dev

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-18 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-18 Thread R. David Murray

R. David Murray added the comment:

Janzert: Thanks for the patch.  A contributor agreement is not needed for this 
patch, since it just moves code around, but you might want to submit one in 
case you make any other contributions.  Also let us know what name to use in 
the Misc/ACKS file.

--

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-16 Thread janzert

Changes by janzert :


--
keywords: +patch
Added file: http://bugs.python.org/file31802/mailbox.patch

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-16 Thread R. David Murray

R. David Murray added the comment:

Hopefully a 2.7 patch would also apply to 3.3, so yes, start there.

For the test, I was thinking that in 3.3+ we could use mock to introduce a 
delay.  But looking at the code again it isn't obvious that there is a 
meaningful way to do it that is worth the effort required.  So let's forget 
about the test for this one...a comment about why the time set is done before 
the move would be worthwhile, though.

--

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-16 Thread janzert

janzert added the comment:

I can certainly write a patch if wanted. It should be simply moving and 
modifying two lines in each of the two methods. My understanding is that it 
should be against 2.7 so it can be applied there first then merged forward?

Unfortunately while I can consistently reproduce the problem, with a script 
using pyinotify, I'm pretty lost how to write a test that would catch this.

--

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-16 Thread R. David Murray

R. David Murray added the comment:

That sounds reasonable.  Would you be interested in trying your hand at a 
patch, ideally with a test?

--
components: +email
nosy: +barry, r.david.murray

___
Python tracker 

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



[issue19037] mailbox module modifies maildir file times after moving from tmp directory

2013-09-16 Thread janzert

New submission from janzert:

The Maildir.add and Maildir.__setitem__ methods in the mailbox module attempts 
to change the file mtime after moving the file into the new directory. This 
allows a race condition since other programs are can move or otherwise modify 
the file as soon as it is placed in the new directory. If the file is moved 
from the new directory before the mtime is set this results in an unexpected 
OSError exception.

The fix seems to simply be setting the file mtime before moving the file into 
its final position.

--
components: Library (Lib)
messages: 197930
nosy: janzert, petri.lehtinen
priority: normal
severity: normal
status: open
title: mailbox module modifies maildir file times after moving from tmp 
directory
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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