Patchwork [google] Omit date from Fortran .mod files for reproducible builds

login
register
mail settings
Submitter Simon Baldwin
Date Jan. 27, 2011, 2 p.m.
Message ID <20110127140000.872841C6CDC@hpgntab-ubiq73.eem.corp.google.com>
Download mbox | patch
Permalink /patch/80698/
State New
Headers show

Comments

Simon Baldwin - Jan. 27, 2011, 2 p.m.
Omit date from Fortran .mod files for reproducible builds.

Strict build environments do binary comparisons of files across gcc builds.
Writing the current timestamp into a Fortran .mod file leads to false
positives from such environments.  Omitting the timestamp removes these
false positives.

Targeted for the google/integration branch.

gcc/fortran/ChangeLog.google:
2011-01-27  Simon Baldwin  <simonb@google.com>

	* module.c (gfc_dump_module): Omit timestamp from output.

Google ref: 39202, 25691, 13445, 13307
Diego Novillo - Jan. 27, 2011, 2:02 p.m.
On Thu, Jan 27, 2011 at 09:00, Simon Baldwin <simonb@google.com> wrote:

> 2011-01-27  Simon Baldwin  <simonb@google.com>
>
>        * module.c (gfc_dump_module): Omit timestamp from output.

OK.

Diego.
Tobias Burnus - Jan. 28, 2011, 11:19 a.m.
We (Janne and I) think this patch can also be applied to the GCC 4.6 
trunk; as the date is never read there is also no .mod ABI issue.

I assume that there are no copyright issues.

Cf. also short "discussion"
    at http://gcc.gnu.org/ml/fortran/2011-01/msg00270.html

Tobias

On 01/27/2011 03:00 PM, Simon Baldwin wrote:
> Omit date from Fortran .mod files for reproducible builds.
>
> Strict build environments do binary comparisons of files across gcc builds.
> Writing the current timestamp into a Fortran .mod file leads to false
> positives from such environments.  Omitting the timestamp removes these
> false positives.
>
> Targeted for the google/integration branch.
>
> gcc/fortran/ChangeLog.google:
> 2011-01-27  Simon Baldwin<simonb@google.com>
>
> 	* module.c (gfc_dump_module): Omit timestamp from output.
>
> Google ref: 39202, 25691, 13445, 13307
>
>
> Index: gcc/fortran/module.c
> ===================================================================
> --- gcc/fortran/module.c	(revision 169330)
> +++ gcc/fortran/module.c	(working copy)
> @@ -5116,8 +5116,7 @@ void
>   gfc_dump_module (const char *name, int dump_flag)
>   {
>     int n;
> -  char *filename, *filename_tmp, *p;
> -  time_t now;
> +  char *filename, *filename_tmp;
>     fpos_t md5_pos;
>     unsigned char md5_new[16], md5_old[16];
>
> @@ -5159,13 +5158,8 @@ gfc_dump_module (const char *name, int d
>   		     filename_tmp, xstrerror (errno));
>
>     /* Write the header, including space reserved for the MD5 sum.  */
> -  now = time (NULL);
> -  p = ctime (&now);
> -
> -  *strchr (p, '\n') = '\0';
> -
> -  fprintf (module_fp, "GFORTRAN module version '%s' created from %s on %s\n"
> -	   "MD5:", MOD_VERSION, gfc_source_file, p);
> +  fprintf (module_fp, "GFORTRAN module version '%s' created from %s\n"
> +	   "MD5:", MOD_VERSION, gfc_source_file);
>     fgetpos (module_fp,&md5_pos);
>     fputs ("00000000000000000000000000000000 -- "
>   	"If you edit this, you'll get what you deserve.\n\n", module_fp);
>
Diego Novillo - Jan. 28, 2011, 6 p.m.
On Fri, Jan 28, 2011 at 06:19, Tobias Burnus <burnus@net-b.de> wrote:
> We (Janne and I) think this patch can also be applied to the GCC 4.6 trunk;
> as the date is never read there is also no .mod ABI issue.
>
> I assume that there are no copyright issues.

There aren't.  Google has signed a blanket copyright assignment with
the FSF.  Any patch coming from a google.com address is covered.

I'll mark this patch for trunk.  Thanks.


Diego.

Patch

Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c	(revision 169330)
+++ gcc/fortran/module.c	(working copy)
@@ -5116,8 +5116,7 @@  void
 gfc_dump_module (const char *name, int dump_flag)
 {
   int n;
-  char *filename, *filename_tmp, *p;
-  time_t now;
+  char *filename, *filename_tmp;
   fpos_t md5_pos;
   unsigned char md5_new[16], md5_old[16];
 
@@ -5159,13 +5158,8 @@  gfc_dump_module (const char *name, int d
 		     filename_tmp, xstrerror (errno));
 
   /* Write the header, including space reserved for the MD5 sum.  */
-  now = time (NULL);
-  p = ctime (&now);
-
-  *strchr (p, '\n') = '\0';
-
-  fprintf (module_fp, "GFORTRAN module version '%s' created from %s on %s\n"
-	   "MD5:", MOD_VERSION, gfc_source_file, p);
+  fprintf (module_fp, "GFORTRAN module version '%s' created from %s\n"
+	   "MD5:", MOD_VERSION, gfc_source_file);
   fgetpos (module_fp, &md5_pos);
   fputs ("00000000000000000000000000000000 -- "
 	"If you edit this, you'll get what you deserve.\n\n", module_fp);