Skip to content

TKLBAM DirIndex incorrectly handles mtime #1985

Open
@OnGle

Description

@OnGle

It's not clear (to me) when this bug was introduced, it is possible that it's existed for the entire lifetime of tklbam.

The stat structure's mtime value is now almost always a float. Pre python 2.5 it was an int by default, 2.5 and after it is a float for all systems that support sub-second mtime values. Nowadays, most systems support sub-second mtime values afaik.

The mtime value is handled incorrectly in 2 places:
https://github.com/turnkeylinux/tklbam/blob/ec65887692fe336f121d95fdeb97c8dd31bd01e7/dirindex.py#L71
and
https://github.com/turnkeylinux/tklbam/blob/ec65887692fe336f121d95fdeb97c8dd31bd01e7/dirindex.py#L63

The latter is the real issue, this is the value that will be written to a file by dirindex. In python2, the %x format specifier will accept a float and silently truncate it, then format it as an integer in hex.

Because of this changes.whatschanged will report files as being different, even between a dirindex, and the same dirindex that has been saved to file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions