Package: gfortran-7
Version: 0.7.2-1
Severity: normal
Tags: upstream patch

gfortran creates binary .mod and .smod files. These are compressed files, which 
look like:
(viewed with e.g. zmore /usr/include/cgns.mod ):

GFORTRAN module version '14' created from 
/build/libcgns-XmhIxt/libcgns-3.3.0/src/cgns_f.F90
(() () () () () () () () () () () () () () () () () () () () () () () ()
() () ())

The full path of the compiled fortran file is included, which can break 
reproducible builds.

A trivial patch is included, to strip the path.

-- System Information:
Debian Release: 9.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-5-686-pae (SMP w/1 CPU core)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_IE.UTF-8), LANGUAGE=en_IE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set 
to en_IE.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Description: Drop the full pathname from module file descriptions, as
 this breaks reproducible builds
Author: Alastair McKinstry
Last-Updated: 2018-02-02
Forwarded: no

Index: gcc-7-7.2.0/src/gcc/fortran/module.c
===================================================================
--- gcc-7-7.2.0.orig/src/gcc/fortran/module.c
+++ gcc-7-7.2.0/src/gcc/fortran/module.c
@@ -79,6 +79,10 @@ along with GCC; see the file COPYING3.
 #include "scanner.h"
 #include <zlib.h>
 
+/* for GNU / POSIX basename */
+#define _GNU_SOURCE
+#include <string.h>
+
 #define MODULE_EXTENSION ".mod"
 #define SUBMODULE_EXTENSION ".smod"
 
@@ -6063,8 +6067,9 @@ dump_module (const char *name, int dump_
     gfc_fatal_error ("Can't open module file %qs for writing at %C: %s",
                     filename_tmp, xstrerror (errno));
 
+  /* Use basename to make builds bit-reproducible */
   gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n",
-           MOD_VERSION, gfc_source_file);
+            MOD_VERSION, basename(gfc_source_file));
 
   /* Write the module itself.  */
   iomode = IO_OUTPUT;

Reply via email to