Source: fontforge
Version: 1:20230101~dfsg-8
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: timezone toolchain
X-Debbugs-Cc: [email protected]

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
fontforge generates .afm and .pfb files that are unreproducible.

Specifically, whilst they use SOURCE_DATE_EPOCH for the timestamps,
they still vary on the timezone due to the use of ctime(3).

Patch attached, which at least causes packages such as t1-teams to be
reproducible.

However, there are many other ctime callsites in the codebase that might
require upstream to investigate: some of them are for ~diagnostic output
for human consumption, so likely should specify the timezone explicitly,
whatever it is.

(Alternatively, another method could be added to gutils/gutils.c alongside
GetTime that will return asctime(gmtime(arg)) if SOURCE_DATE_EPOCH is present,
otherwise return cmtime(arg), and then callsites could use this one.)

  [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
diff --git fontforge/dumppfa.c fontforge/dumppfa.c
index 7acdedc..aad2c73 100644
--- fontforge/dumppfa.c
+++ fontforge/dumppfa.c
@@ -1780,7 +1780,7 @@ static void dumpfontcomments(void (*dumpchar)(int ch,void 
*data), void *data,
        dumpf(dumpchar,data,"%%%%Title: %s\n", sf->fontname);
        dumpf(dumpchar,data,"%%Version: %s\n", sf->version);
     }
-    dumpf(dumpchar,data,"%%%%CreationDate: %s", ctime(&now));
+    dumpf(dumpchar,data,"%%%%CreationDate: %s", asctime(gmtime(&now)));
     if ( author!=NULL )
        dumpf(dumpchar,data,"%%%%Creator: %s\n", author);
 
diff --git fontforge/splinesaveafm.c fontforge/splinesaveafm.c
index 15b42b7..4c96eda 100644
--- fontforge/splinesaveafm.c
+++ fontforge/splinesaveafm.c
@@ -1184,7 +1184,7 @@ static void AfmSplineFontHeader(FILE *afm, SplineFont 
*sf, int formattype,
                          "StartFontMetrics 2.0\n" );
     fprintf( afm, "Comment Generated by FontForge %s\n", FONTFORGE_VERSION );
     now = GetTime();
-    fprintf(afm,"Comment Creation Date: %s", ctime(&now));
+    fprintf(afm,"Comment Creation Date: %s", asctime(gmtime(&now)));
     fprintf( afm, "FontName %s\n", sf->fontname );
     if ( sf->fullname!=NULL ) fprintf( afm, "FullName %s\n", sf->fullname );
     if ( sf->familyname!=NULL ) fprintf( afm, "FamilyName %s\n", 
sf->familyname );

Reply via email to