[Python-Dev] Bizarre mtime behaviour

Adam Olsen rhamph at gmail.com
Sun Nov 1 17:25:39 CET 2009


On Sun, Nov 1, 2009 at 08:23, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Hello,
>
> I wondered if someone had a clue about the following behaviour.
> While debugging an erratic test_mailbox failure on RDM's buildbot (and other
> machines), it turned out that the system sometimes set the wrong mtime on a
> directory:
>
> $ date && python -c 'import os; os.link("setup.py", "t/c")' && stat t && date
>
> Sun Nov  1 09:49:04 EST 2009
>  File: `t'
>  Size: 144             Blocks: 0          IO Block: 4096   directory
> Device: 811h/2065d      Inode: 223152      Links: 2
> Access: (0755/drwxr-xr-x)  Uid: ( 1001/  pitrou)   Gid: ( 1005/  pitrou)
> Access: 2009-11-01 09:10:11.000000000 -0500
> Modify: 2009-11-01 09:49:03.000000000 -0500
> Change: 2009-11-01 09:49:03.000000000 -0500
> Sun Nov  1 09:49:04 EST 2009
>
> As you see above, the mtime for directory 't' is set to a full second before the
> actual modification has happened.
>
> Sprinkling traces of time.time() and os.path.getmtime() on Lib/mailbox.py shows
> this is exactly what trips up test_mailbox. I've got posted a patch to fix it
> (see issue #6896), but I would like to know if such OS behaviour is normal.

Looks like an OS bug to me.  Linux I'm guessing?


-- 
Adam Olsen, aka Rhamphoryncus


More information about the Python-Dev mailing list