unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
blob 7f9310e994aa5854e3364096a95990d1c32f0171 2443 bytes (raw)
name: gnu/packages/patches/binutils-2.14-deterministic-ar.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 
Old binutils do not have support for creating deterministic archives.
Backported from upstream commit 36e4dce69dd23bea9ea2258dea35f034b6d6351c

Patch by Chris Demetriou <cgd@google.com> (2009), adapted by
Andrius Štikonas <andrius@stikonas.eu> (2021).

--- a/bfd/archive.c	2021-03-01 00:05:54.888301655 +0000
+++ b/bfd/archive.c	2021-03-02 21:53:51.001617689 +0000
@@ -1396,10 +1396,6 @@
     {
       /* Assume we just "made" the member, and fake it.  */
       struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
-      time (&status.st_mtime);
-      status.st_uid = getuid ();
-      status.st_gid = getgid ();
-      status.st_mode = 0644;
       status.st_size = bim->size;
     }
   else if (stat (filename, &status) != 0)
@@ -1408,6 +1404,11 @@
       return NULL;
     }
 
+  status.st_mtime = 0;
+  status.st_uid = 0;
+  status.st_gid = 0;
+  status.st_mode = 0644;
+
   amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
   ared = (struct areltdata *) bfd_zalloc (abfd, amt);
   if (ared == NULL)
@@ -2003,13 +2004,11 @@
   stat (arch->filename, &statbuf);
   memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
   sprintf (hdr.ar_name, RANLIBMAG);
-  /* Remember the timestamp, to keep it holy.  But fudge it a little.  */
-  bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET;
   bfd_ardata (arch)->armap_datepos = (SARMAG
 				      + offsetof (struct ar_hdr, ar_date[0]));
-  sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
-  sprintf (hdr.ar_uid, "%ld", (long) getuid ());
-  sprintf (hdr.ar_gid, "%ld", (long) getgid ());
+  sprintf (hdr.ar_date, "%ld", 0);
+  sprintf (hdr.ar_uid, "%ld", 0);
+  sprintf (hdr.ar_gid, "%ld", 0);
   sprintf (hdr.ar_size, "%-10d", (int) mapsize);
   strncpy (hdr.ar_fmag, ARFMAG, 2);
   for (i = 0; i < sizeof (struct ar_hdr); i++)
@@ -2082,6 +2081,8 @@
   struct ar_hdr hdr;
   unsigned int i;
 
+  return TRUE;
+
   /* Flush writes, get last-write timestamp from file, and compare it
      to the timestamp IN the file.  */
   bfd_flush (arch);
@@ -2169,7 +2170,7 @@
   memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
   hdr.ar_name[0] = '/';
   sprintf (hdr.ar_size, "%-10d", (int) mapsize);
-  sprintf (hdr.ar_date, "%ld", (long) time (NULL));
+  sprintf (hdr.ar_date, "%ld", 0);
   /* This, at least, is what Intel coff sets the values to.  */
   sprintf ((hdr.ar_uid), "%d", 0);
   sprintf ((hdr.ar_gid), "%d", 0);

debug log:

solving 7f9310e994 ...
found 7f9310e994 in https://yhetil.org/guix-bugs/87lfb4s5z7.fsf@gnu.org/

applying [1/1] https://yhetil.org/guix-bugs/87lfb4s5z7.fsf@gnu.org/
diff --git a/gnu/packages/patches/binutils-2.14-deterministic-ar.patch b/gnu/packages/patches/binutils-2.14-deterministic-ar.patch
new file mode 100644
index 0000000000..7f9310e994

1:29: trailing whitespace.
 
1:45: space before tab in indent.
 				      + offsetof (struct ar_hdr, ar_date[0]));
1:58: trailing whitespace.
 
Checking patch gnu/packages/patches/binutils-2.14-deterministic-ar.patch...
Applied patch gnu/packages/patches/binutils-2.14-deterministic-ar.patch cleanly.
warning: 3 lines add whitespace errors.

index at:
100644 7f9310e994aa5854e3364096a95990d1c32f0171	gnu/packages/patches/binutils-2.14-deterministic-ar.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).