Hello List,

xz when built for Windows with gcc on mingw32 or mingw-w64 does not preserve
timestamps. I have found that this is because MinGW only provides utime() with
filename as target, and this means that the file time is adjusted by
io_copy_attrs() and then immediately reset to 'now' when the dest_fd is closed
afterwards in io_close().

I have done a bit of digging and mingw actually has futime() (in <sys/utime.h>),
but for some reason exports it only as _futime(). Only utime() is wrapped with a
non-underscore-version.

Using something like this in io_copy_attrs works just fine and would fix the
issue...
        (void)_futime(pair->dest_fd, &buf);

Alternatively systems that need a file name could maybe first close the file and
then set the file time, but that would complicate things...


Regards,
Martok

Reply via email to