Debian Bug report logs - #1035375
mtools: interprets SOURCE_DATE_EPOCH in system timezone instead of UTC

version graph

Package: mtools; Maintainer for mtools is Debian QA Group <packages@qa.debian.org>; Source for mtools is src:mtools (PTS, buildd, popcon).

Reported by: Alper Nebi Yasak <alpernebiyasak@gmail.com>

Date: Tue, 2 May 2023 11:03:02 UTC

Severity: wishlist

Tags: patch

Found in version mtools/4.0.33-1+really4.0.32-1

Forwarded to https://lists.gnu.org/archive/html/info-mtools/2023-05/msg00000.html

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, reproducible-bugs@lists.alioth.debian.org, Chris Lamb <lamby@debian.org>:
Bug#1035375; Package mtools. (Tue, 02 May 2023 11:03:03 GMT) (full text, mbox, link).


Acknowledgement sent to Alper Nebi Yasak <alpernebiyasak@gmail.com>:
New Bug report received and forwarded. Copy sent to reproducible-bugs@lists.alioth.debian.org, Chris Lamb <lamby@debian.org>. (Tue, 02 May 2023 11:03:03 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: mtools: interprets SOURCE_DATE_EPOCH in system timezone instead of UTC
Date: Tue, 2 May 2023 14:00:44 +0300
Package: mtools
Version: 4.0.33-1+really4.0.32-1
Severity: wishlist
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps toolchain
X-Debbugs-Cc: reproducible-bugs@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.



Information forwarded to debian-bugs-dist@lists.debian.org, Chris Lamb <lamby@debian.org>:
Bug#1035375; Package mtools. (Tue, 02 May 2023 18:00:03 GMT) (full text, mbox, link).


Acknowledgement sent to "Chris Lamb" <lamby@debian.org>:
Extra info received and forwarded to list. Copy sent to Chris Lamb <lamby@debian.org>. (Tue, 02 May 2023 18:00:03 GMT) (full text, mbox, link).


Message #10 received at 1035375@bugs.debian.org (full text, mbox, reply):

From: "Chris Lamb" <lamby@debian.org>
To: "Alper Nebi Yasak" <alpernebiyasak@gmail.com>, 1035375@bugs.debian.org
Subject: Re: Bug#1035375: mtools: interprets SOURCE_DATE_EPOCH in system timezone instead of UTC
Date: Tue, 02 May 2023 10:57:18 -0700
tags 1035375 + patch
forwarded 1035375 https://lists.gnu.org/archive/html/info-mtools/2023-05/msg00000.html
thanks

Hi Alper,

> 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:

Ah, interesting! And your reproducer is extremely helpful, and
I've managed to put together a proof-of-concept patch:

    --- a/directory.c
    +++ b/directory.c
    @@ -104,7 +104,7 @@ struct directory *mk_entry(const dos_name_t *dn, unsigned char attr,
      uint8_t hour, min_hi, min_low, sec;
      uint8_t year, month_hi, month_low, day;
     
    -	now = localtime(&date2);
    +	now = gmtime(&date2);
      dosnameToDirentry(dn, ndir);
      ndir->attr = attr;
      ndir->ctime_ms = 0;
    -- 
    2.40.1

I've gone ahead and forwarded this to the mtools mailing list here:

  https://lists.gnu.org/archive/html/info-mtools/2023-05/msg00000.html


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org 🍥 chris-lamb.co.uk
       `-





Added tag(s) patch. Request was from "Chris Lamb" <lamby@debian.org> to control@bugs.debian.org. (Tue, 02 May 2023 18:00:04 GMT) (full text, mbox, link).


Set Bug forwarded-to-address to 'https://lists.gnu.org/archive/html/info-mtools/2023-05/msg00000.html'. Request was from "Chris Lamb" <lamby@debian.org> to control@bugs.debian.org. (Tue, 02 May 2023 18:00:04 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Aug 19 14:57:28 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.