Bug#1035375: mtools: interprets SOURCE_DATE_EPOCH in system timezone instead of UTC

Alper Nebi Yasak alpernebiyasak at gmail.com
Tue May 2 12:00:44 BST 2023


Package: mtools
Version: 4.0.33-1+really4.0.32-1
Severity: wishlist
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps toolchain
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org


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.



More information about the Reproducible-bugs mailing list