This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients loewis, vstinner
Date 2010-10-29.12:08:14
SpamBayes Score 2.1218421e-10
Marked as misclassified No
Message-id <1288354101.14.0.267054038013.issue10230@psf.upfronthosting.co.za>
In-reply-to
Content
test_tarfile in only failing on one 3.x buildbot: AMD64 debian parallel 3.x. The problem is related to the mtime field and os.utime():

http://www.python.org/dev/buildbot/builders/AMD64 debian parallel 3.x/builds/508/steps/test/logs/stdio
======================================================================
FAIL: test_extractall (test.test_tarfile.MiscReadTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/autofs/net/homedir/home/martin.vonloewis/buildarea/3.x.loewis-parallel2/build/Lib/test/test_tarfile.py", line 358, in test_extractall
    self.assertEqual(tarinfo.mtime, file_mtime, errmsg)
AssertionError: tar mtime 1041808783 (int) != file time 1041808783.000001 (0x1.f0c5ec7800008p+29) of path '/var/autofs/net/homedir/home/martin.vonloewis/buildarea/3.x.loewis-parallel2/build/build/test_python_23882/@test_23882_tmp-tardir/ustar/dirtype'

======================================================================
FAIL: test_extractall (test.test_tarfile.GzipMiscReadTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/autofs/net/homedir/home/martin.vonloewis/buildarea/3.x.loewis-parallel2/build/Lib/test/test_tarfile.py", line 358, in test_extractall
    self.assertEqual(tarinfo.mtime, file_mtime, errmsg)
AssertionError: tar mtime 1041808783 (int) != file time 1041808783.000003 (0x1.f0c5ec7800019p+29) of path '/var/autofs/net/homedir/home/martin.vonloewis/buildarea/3.x.loewis-parallel2/build/build/test_python_23882/@test_23882_tmp-tardir/ustar/dirtype'

======================================================================
FAIL: test_extractall (test.test_tarfile.Bz2MiscReadTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/autofs/net/homedir/home/martin.vonloewis/buildarea/3.x.loewis-parallel2/build/Lib/test/test_tarfile.py", line 358, in test_extractall
    self.assertEqual(tarinfo.mtime, file_mtime, errmsg)
AssertionError: tar mtime 1041808783 (int) != file time 1041808783.000005 (0x1.f0c5ec780002ap+29) of path '/var/autofs/net/homedir/home/martin.vonloewis/buildarea/3.x.loewis-parallel2/build/build/test_python_23882/@test_23882_tmp-tardir/ustar/dirtype'

----------------------------------------------------------------------

(I patched test_extractall to dump mtime values as hexadecimal for floats)

Binary dump os this "ustar/dirtype" entry:

15360) file[2]: Tar File (ustar/dirtype/: Directory, 0 bytes) (512 bytes)
      0) name= "ustar/dirtype/": Name (100 bytes)
      100) mode= "0000755": Mode (8 bytes)
      108) uid= "0001750": User ID (8 bytes)
      116) gid= "0000144": Group ID (8 bytes)
      124) size= "00000000000": Size (12 bytes)
      136) mtime= "07606136617": Modification time (12 bytes)
      148) check_sum= "015042": Check sum (8 bytes)
      156) type= Directory: Type (1 byte)
      157) lname= (empty): Link name (100 bytes)
      257) magic= "ustar\x0000": Magic (8 bytes)
      265) uname= "tarfile": User name (32 bytes)
      297) gname= "tarfile": Group name (32 bytes)
      329) devmajor= "0000000": Dev major (8 bytes)
      337) devminor= "0000000": Dev minor (8 bytes)
      345) padding= <null>: Padding (zero) (167 bytes)             

So this directory has no PAX extra headers, only classical headers, and mtime is 0o7606136617 (1041808783).

os.utime() gets an integer with exact value 1041808783, but then os.stat() gives st_mtime:
 - 1041808783.000001 (0x1.f0c5ec7800008p+29)
 - 1041808783.000003 (0x1.f0c5ec7800019p+29)
 - 1041808783.000005 (0x1.f0c5ec780002ap+29)

To set file time, os.utime() has 4 implementations:
 - SetFileTime() for Windows
 - utimes() using struct timeval
 - utime() using time_t
 - utime() using struct utimbuf

I don't know which one is used (except that it is not supposed to be a Windows host :-)).
History
Date User Action Args
2010-10-29 12:08:21vstinnersetrecipients: + vstinner, loewis
2010-10-29 12:08:21vstinnersetmessageid: <1288354101.14.0.267054038013.issue10230@psf.upfronthosting.co.za>
2010-10-29 12:08:19vstinnerlinkissue10230 messages
2010-10-29 12:08:14vstinnercreate