summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-12-10 01:05:13 +0000
committerZac Medico <zmedico@gentoo.org>2009-12-10 01:05:13 +0000
commit83c08281872aef17ff58bfc14f7090e8beb7c38f (patch)
tree948ca5d96fdb97c2febb37911d44ff6eaa344d1f
parent7eccd2f7ae59c0df1c208ea40524a6eff3aafc18 (diff)
downloadportage-83c08281872aef17ff58bfc14f7090e8beb7c38f.tar.gz
portage-83c08281872aef17ff58bfc14f7090e8beb7c38f.tar.bz2
portage-83c08281872aef17ff58bfc14f7090e8beb7c38f.zip
In movefile(), always use stat_obj[stat.ST_MTIME] for the integral timestamp
which is returned, since the stat_obj.st_mtime float attribute rounds *up* if the nanosecond part of the timestamp is 999999881 ns or greater. (trunk r14995) svn path=/main/branches/2.1.7/; revision=15011
-rw-r--r--pym/portage/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 6b8d44cb7..ba6942672 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7623,9 +7623,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
print("!!!",e)
return None
+ # Always use stat_obj[stat.ST_MTIME] for the integral timestamp which
+ # is returned,, since the stat_obj.st_mtime float attribute rounds *up*
+ # if the nanosecond part of the timestamp is 999999881 ns or greater.
try:
if hardlinked:
- newmtime = long(os.stat(dest).st_mtime)
+ newmtime = os.stat(dest)[stat.ST_MTIME]
else:
# Note: It is not possible to preserve nanosecond precision
# (supported in POSIX.1-2008 via utimensat) with the IEEE 754
@@ -7638,12 +7641,12 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
# rename automatically preserves timestamps with complete
# precision.
os.utime(dest, (sstat.st_atime, sstat.st_mtime))
- newmtime = long(sstat.st_mtime)
+ newmtime = sstat[stat.ST_MTIME]
except OSError:
# The utime can fail here with EPERM even though the move succeeded.
# Instead of failing, use stat to return the mtime if possible.
try:
- newmtime = long(os.stat(dest).st_mtime)
+ newmtime = os.stat(dest)[stat.ST_MTIME]
except OSError as e:
writemsg(_("!!! Failed to stat in movefile()\n"), noiselevel=-1)
writemsg("!!! %s\n" % dest, noiselevel=-1)