public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janne Blomqvist <blomqvist.janne@gmail.com>
To: fortran@gcc.gnu.org,	gcc-patches@gcc.gnu.org
Cc: Janne Blomqvist <blomqvist.janne@gmail.com>
Subject: [PATCH, committed] Make module files reproducible
Date: Tue, 13 Feb 2018 07:59:00 -0000	[thread overview]
Message-ID: <1518508769-3277-1-git-send-email-blomqvist.janne@gmail.com> (raw)

Using lbasename ensures that the build path does not end up in the
module file.

Regtested on x86_64-pc-linux-gnu, committed to trunk. Will shortly
backport to the 6 and 7 branches as well.

2018-02-13  Alastair McKinstry  <alastair.mckinstry@sceal.ie>
	    Janne Blomqvist  <jb@gcc.gnu.org>

	* module.c (dump_module): Use lbasename to ensure that module
	files are reproducible.
---
 gcc/fortran/module.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index b120501..c833e67 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -6148,8 +6148,10 @@ dump_module (const char *name, int dump_flag)
     gfc_fatal_error ("Can't open module file %qs for writing at %C: %s",
 		     filename_tmp, xstrerror (errno));
 
+  /* Use lbasename to ensure module files are reproducible regardless
+     of the build path (see the reproducible builds project).  */
   gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n",
-	    MOD_VERSION, gfc_source_file);
+	    MOD_VERSION, lbasename (gfc_source_file));
 
   /* Write the module itself.  */
   iomode = IO_OUTPUT;
-- 
2.7.4

                 reply	other threads:[~2018-02-13  7:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518508769-3277-1-git-send-email-blomqvist.janne@gmail.com \
    --to=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).