[Distutils] [issue127] time.mktime simple checks fail when is_dst applies to the original timestamp

yaneurabeya setuptools at bugs.python.org
Mon May 9 08:56:05 CEST 2011


New submission from yaneurabeya <yanegomi at gmail.com>:

There's an optimization in pkg_resources.ZipProvider._extract_resource that checks the timestamp of a zip egg's files vs the os.stat output for the real file on disk (if it exists). time.mktime is used. The problem with using this function call with -1, is that if the underlying timezone is modified between the time that the file was installed, and the next time the file is being installed or the file itself was stored without a value relative to a timezone, the _extract_resource method will re-extract and install the new file, even if the contents are the same on disk. This generates more unnecessary I/O, and creates race conditions depending on how things are installed on disk.

calendar.timegm can be used in its place, but it's not necessarily present on non-Unix platforms. A quick check that I ran shows that it's present on Cygwin, FreeBSD, Linux, and OSX however.

----------
messages: 622
nosy: yaneurabeya
priority: feature
status: unread
title: time.mktime simple checks fail when is_dst applies to the original timestamp

_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue127>
_______________________________________________


More information about the Distutils-SIG mailing list