[New-bugs-announce] [issue10230] test_tarfile failure (test_extractall) on AMD64 debian parallel 3.x: os.utime(float) issue

STINNER Victor report at bugs.python.org
Fri Oct 29 14:08:21 CEST 2010


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

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 :-)).

----------
components: Library (Lib), Tests
keywords: buildbot
messages: 119890
nosy: haypo, loewis
priority: normal
severity: normal
status: open
title: test_tarfile failure (test_extractall) on AMD64 debian parallel 3.x: os.utime(float) issue
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10230>
_______________________________________


More information about the New-bugs-announce mailing list