File 0009-Don-t-use-timestamps-to-create-a-unique-id-bnc-91595.patch of Package syslinux
From 2352b48fa01ebacac8e387987187cc0a68372e5a Mon Sep 17 00:00:00 2001
From: Steffen Winterfeldt <snwint@suse.de>
Date: Wed, 4 Feb 2015 16:00:26 +0100
Subject: [PATCH 09/22] Don't use timestamps to create a unique id (bnc#915950)
---
libinstaller/bin2c.pl | 7 -------
libinstaller/syslinux.h | 3 ---
now.pl | 37 +++++++++++++++++++------------------
3 files changed, 19 insertions(+), 28 deletions(-)
mode change 100644 => 100755 now.pl
diff --git a/libinstaller/bin2c.pl b/libinstaller/bin2c.pl
index c79a506f..28644880 100755
--- a/libinstaller/bin2c.pl
+++ b/libinstaller/bin2c.pl
@@ -71,11 +71,4 @@ if ($align != 0) {
printf "\n};\n\nconst unsigned int %s_len = %u;\n", $table_name, $total_len;
-if (defined $ENV{'SOURCE_DATE_EPOCH'}) {
- printf "\nconst int %s_mtime = %s;\n", $table_name, $ENV{'SOURCE_DATE_EPOCH'};
-} else {
- @st = stat STDIN;
- printf "\nconst int %s_mtime = %d;\n", $table_name, $st[9];
-}
-
exit 0;
diff --git a/libinstaller/syslinux.h b/libinstaller/syslinux.h
index f6c64333..de3e6614 100644
--- a/libinstaller/syslinux.h
+++ b/libinstaller/syslinux.h
@@ -28,11 +28,9 @@
/* The standard boot sector and ldlinux image */
extern unsigned char syslinux_bootsect[];
extern const unsigned int syslinux_bootsect_len;
-extern const int syslinux_bootsect_mtime;
extern unsigned char _slimg syslinux_ldlinux[];
extern const unsigned int syslinux_ldlinux_len;
-extern const int syslinux_ldlinux_mtime;
extern unsigned char _slimg syslinux_ldlinuxc32[];
extern const unsigned int syslinux_ldlinuxc32_len;
@@ -44,7 +42,6 @@ extern const unsigned int syslinux_ldlinuxc32_len;
extern unsigned char syslinux_mbr[];
extern const unsigned int syslinux_mbr_len;
-extern const int syslinux_mbr_mtime;
/* Sector size assumptions... */
#define SECTOR_SHIFT 9
diff --git a/now.pl b/now.pl
old mode 100644
new mode 100755
index a3b5a798..60c4fe06
--- a/now.pl
+++ b/now.pl
@@ -1,21 +1,22 @@
-#!/usr/bin/perl
-#
-# Print the time (possibly the mtime of a file) as a hexadecimal integer
-# If more than one file, print the mtime of the *newest* file.
-#
-
-undef $now;
-
-foreach $file ( @ARGV ) {
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
- $ctime,$blksize,$blocks) = stat($file);
- if ( !defined($now) || $now < $mtime ) {
- $now = $mtime;
- }
-}
+#! /usr/bin/perl
+
+# Use checksum over all sources and source file names to create some unique id.
+
+use Digest::SHA;
+
+use strict;
-if ( !defined($now) ) {
- $now = time;
+my $digest = Digest::SHA->new(256);
+
+# print STDERR "now.pl: ", join(" ", @ARGV) , "\n";
+
+for (sort @ARGV) {
+ $digest->add($_);
+ $digest->addfile($_);
}
-printf "0x%08x\n", $now;
+my $val = substr($digest->hexdigest, 0, 8);
+
+# printf STDERR "now.pl: = 0x$val\n";
+
+print "0x$val\n";
--
2.42.0