[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1006256: gmerlin: reproducible builds: Timestamps embedded in manpages



Source: gmerlin
Severity: normal
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org

The build timestamp is embedded in manpages:

  ./usr/share/man/man1/mdb-tool.1.gz

  -.TH MDB-TOOL 1 "February 2022" Gmerlin "User Manuals"
  vs.
  +.TH MDB-TOOL 1 "November 2022" Gmerlin "User Manuals"


The attached patch fixes this by respecting the SOURCE_DATE_EPOCH
environment variable in the manpage generation code in lib/cmdline.c.


With this patch applied, gmerlin should build reproducibly on
tests.reproducible-builds.org!


Thanks for maintaining gmerlin!


live well,
  vagrant
From d532ebe90243f9390b0b1e49f1d4918f173238a6 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Tue, 22 Feb 2022 03:25:25 +0000
Subject: [PATCH] lib/cmdline.c: Use deterministic timestamp when generating
 manpages.

Use the SOURCE_DATE_EPOCH environment variable if available, and use
numeric date to avoid embedding locale-dependent month names.

https://reproducible-builds.org/docs/source-date-epoch/
---
 lib/cmdline.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline.c b/lib/cmdline.c
index 4b4d2f6..049e905 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -441,9 +441,13 @@ void bg_cmdline_print_help(char * argv0, bg_help_format_t format)
       char ** args;
       char * string_uc;
       
-      time(&t);
-      localtime_r(&t, &brokentime);
-      strftime(date_str, 511, "%B %Y", &brokentime);
+      char *source_date_epoch;
+      /* This assumes that the SOURCE_DATE_EPOCH environment variable will contain
+         a correct, positive integer in the time_t range */
+      if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
+          (t = (time_t)strtoll(source_date_epoch, NULL, 10)) <= 0)
+        time(&t);
+      strftime(date_str, 511, "%F", gmtime(&t));
 
       string_uc = bg_toupper(bg_app_get_name());
       
-- 
2.35.1

Attachment: signature.asc
Description: PGP signature


Reply to: