public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH rebase 2/2] rebase: Don't update the PE header timestamp unless -t is used
@ 2023-08-12 12:29 Christian Franke
  0 siblings, 0 replies; only message in thread
From: Christian Franke @ 2023-08-12 12:29 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

This changes existing behavior but a new option --keep-timestamp is IMO 
not needed.

-- 
Regards,
Christian


[-- Attachment #2: 0001-rebase-Don-t-update-the-PE-header-timestamp-unless-t.patch --]
[-- Type: text/plain, Size: 2101 bytes --]

From 1c13ccb047ebfbcd2f239bedcd50a128fec659e9 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Sat, 12 Aug 2023 14:17:04 +0200
Subject: [PATCH] rebase: Don't update the PE header timestamp unless -t is
 used

This enables reproducible rebase.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
---
 imagehelper/rebaseimage.cc | 6 ++++--
 rebase.c                   | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/imagehelper/rebaseimage.cc b/imagehelper/rebaseimage.cc
index 8827a14..0dec93c 100755
--- a/imagehelper/rebaseimage.cc
+++ b/imagehelper/rebaseimage.cc
@@ -111,12 +111,14 @@ BOOL ReBaseImage64 (
   if (dll.is64bit ())
     {
       ntheader64->OptionalHeader.ImageBase = *NewImageBase;
-      ntheader64->FileHeader.TimeDateStamp = TimeStamp;
+      if (ReBaseChangeFileTime)
+	ntheader64->FileHeader.TimeDateStamp = TimeStamp;
     }
   else
     {
       ntheader32->OptionalHeader.ImageBase = *NewImageBase;
-      ntheader32->FileHeader.TimeDateStamp = TimeStamp;
+      if (ReBaseChangeFileTime)
+	ntheader32->FileHeader.TimeDateStamp = TimeStamp;
     }
 
   int64_t difference = *NewImageBase - *OldImageBase;
diff --git a/rebase.c b/rebase.c
index 20a9902..6a531d0 100644
--- a/rebase.c
+++ b/rebase.c
@@ -1687,7 +1687,8 @@ Rebase PE files, usually DLLs, to a specified address or address range.\n\
   -o, --offset=OFFSET     Specify an additional offset between adjacent DLLs\n\
                           when rebasing.  Default is no offset.\n\
   -t, --touch             Use this option to make sure the file's modification\n\
-                          time is bumped if it has been successfully rebased.\n\
+                          time and the timestamp in the PE header are bumped if\n\
+                          the file has been successfully rebased.\n\
                           Usually rebase does not change the file's time unless\n\
                           the -c flag is also specified.\n\
   -T, --filelist=FILE     Also rebase the files specified in FILE.  The format\n\
-- 
2.39.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-12 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-12 12:29 [PATCH rebase 2/2] rebase: Don't update the PE header timestamp unless -t is used Christian Franke

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