[New-bugs-announce] [issue13420] newer() function in dep_util.py discard changes in the same second

David Amian report at bugs.python.org
Thu Nov 17 12:23:58 CET 2011

New submission from David Amian <damian at emergya.com>:

Hi, I had a problem making deb packages with distutils and cdbs. Looking for any solution, I found Issue 11933 and saw that the newer() method has been changed, using [ST_MTIME] instead of st_mtime. This commit is to solve Issue 10148 that describes a bug when copying files with python, it depends on the filesystem.

In these changes, modification time of files are checked as a integer, discarding the millisec. It makes the issue.

For example, I've a file that is modified with an installation prefix. CDBS runs the build step and after the install step. In build step, the prefix is '/usr/local' because the prefix argument isn't supported, immediately the install step runs with prefix='/usr', so the file that contains a variable with project path modified with the prefix is not copied by distutils, it runs in a different millisec but in the same second.

Then when install my app, it crashes because the variable with project path is '/usr/local' instead of '/usr' and this variable is used in the source.

To solve this problem I made ​​some modifications on file_util.py and dep_util.py files, I revert the changes of the issue 11933, but rounding all times returned by stat() with two decimals. With that changes, distutils is not affected by the Issue 10148 and if any file is modified in the same second, but in different millisec, distutils will compare it and it wil copy the file.

assignee: tarek
components: Distutils
files: fix_mtime.diff
keywords: patch
messages: 147794
nosy: d.amian, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: newer() function in dep_util.py discard changes in the same second
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file23716/fix_mtime.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list