Hi,
I came across timestamp differences in FAT filesystem images while
trying to build debian-installer with debrepro (among many other
things), and tracked it down to mmd/mcopy calls. Here's a short reproducer:
export SOURCE_DATE_EPOCH="$(date "+%s")"
imgprep() {
[ -f "$1" ] && rm "$1"
mkfs.msdos --invariant -v -i deb00001 -C "$1" 512
mmd -i "$1" ::foo
mcopy -i "$1" "$2" ::bar
}
dd if=/dev/random of=rand.img bs=512 count=200
TZ=UTC imgprep first.img rand.img
TZ=UTC-3 imgprep second.img rand.img
diffoscope first.img second.img
which shows an exact 3-hour difference in timestamps for me. AFAICT,
SOURCE_DATE_EPOCH is meant to be in UTC, so embedded timestamps and the
two files should be the same regardless of TZ or system timezone.
tags 1035375 + patch forwarded 1035375 https://lists.gnu.org/archive/html/info-mtools/2023-05/msg00000.html thanks Hi Alper, Ah, interesting! And your reproducer is extremely helpful, and I've managed to put together a proof-of-concept patch:
Did that get a response from upstream? Seems like a simple patch with limited chance of introducing problems... maybe a slightly more complicated veresion that only does this when SOURCE_DATE_EPOCH is set. Maybe it could be applied to the debian mtools package to at least give it some real-world testing? :) live well, vagrant
Hi mtools maintainers, Alain, it appears the patch posted in 2023 to fix SOURCE_DATE_EPOCH support under non-UTC TZ never made it anywhere. It was posted here: https://lists.gnu.org/archive/html/info-mtools/2023-05/msg00000.html Could you please take a look and maybe apply it? Thanks, Chris
Hi, I had a look at it, and the whole thing is rather confusing. Discussion text seems to be about SOURCE_DATE_EPOCH, but the only patch contained here does something else, i.e. changing how the datetime is stored on the FAT filesystem. Currently, mtools matches Windows' behavior: https://stackoverflow.com/questions/38549583/what-time-zone-does-a-fat32-sd-card-record-timestamps-in : "... The FAT file system records times on disk in local time. ..." Apparently some digital cameras do store time in UTC though. As far as SOURCE_DATE_EPOCH is concerned, this is apparently an integer (seconds since epoch), rather than a structured field showing hour/ minute/seconds, so timezone considerations should not really apply. Regards, Alain