[rebase - The rebase tool, core of the automatic rebase facility during postinstall] branch master, updated. 1def5794ab48d0eae1589378df79714d8ff755d7

jturney-9JcytcrH/[email protected]
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/rebase.git;h=1def5794ab48d0eae1589378df79714d8ff755d7

commit 1def5794ab48d0eae1589378df79714d8ff755d7
Author: Jon Turney <[email protected]>
Date:   Thu Feb 8 22:34:43 2018 +0000

    Fix some errors which cause unnecessary rebases

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/rebase.git;h=f2091d130b7bc09f90fa63494e72da5d50f957f0

commit f2091d130b7bc09f90fa63494e72da5d50f957f0
Author: Jon Turney <[email protected]>
Date:   Thu Feb 8 22:33:07 2018 +0000

    Make verbose give a reason why a rebase is needed


Diff:
---
 rebase.c |   51 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/rebase.c b/rebase.c
index 6f98d37..ca3c59d 100644
--- a/rebase.c
+++ b/rebase.c
@@ -649,7 +649,14 @@ merge_image_info ()
 		{
 		  /* Reuse the old address if possible. */
 		  if (match->slot_size < img_info_list[i].slot_size)
-		    match->base = 0;
+		    {
+		      match->base = 0;
+		      if (verbose)
+		        fprintf (stderr, "rebasing %s because it won't fit in it's old slot size\n", img_info_list[i].name);
+		    }
+		  else if (verbose)
+		    fprintf (stderr, "rebasing %s because it's not located at it's old slot\n", img_info_list[i].name);
+
 		  match->flag.needs_rebasing = 1;
 		}
 	      /* Unconditionally overwrite old with new size. */
@@ -668,8 +675,12 @@ merge_image_info ()
 	      img_info_list[i--] = img_info_list[--img_info_size];
 	    }
 	  else if (!img_info_list[i].flag.cannot_rebase)
-	    /* Not in database yet.  Set base to 0 to choose a new one. */
-	    img_info_list[i].base = 0;
+	    {
+	      /* Not in database yet.  Set base to 0 to choose a new one. */
+	      img_info_list[i].base = 0;
+	      if (verbose)
+		fprintf (stderr, "rebasing %s because not in database yet\n", img_info_list[i].name);
+	    }
 	}
     }
   if (!img_info_rebase_start || force_rebase_flag)
@@ -682,7 +693,11 @@ merge_image_info ()
 	  if (i < img_info_rebase_start)
 	    set_cannot_rebase (&img_info_list[i]);
 	  if (!img_info_list[i].flag.cannot_rebase)
-	    img_info_list[i].base = 0;
+	    {
+	      img_info_list[i].base = 0;
+	      if (verbose)
+		fprintf (stderr, "rebasing %s because forced or database missing\n", img_info_list[i].name);
+	    }
 	}
       img_info_rebase_start = 0;
     }
@@ -726,24 +741,38 @@ merge_image_info ()
 	  if (cur_base != img_info_list[i].base)
 	    {
 	      img_info_list[i].flag.needs_rebasing = 1;
+	      if (verbose)
+		fprintf (stderr, "rebasing %s because it's base has changed (due to being reinstalled?)\n", img_info_list[i].name);
 	      /* Set cur_base to the old base to simplify subsequent tests. */
 	      cur_base = img_info_list[i].base;
 	    }
 	  /* However, if the DLL got bigger and doesn't fit into its slot
 	     anymore, rebase this DLL from scratch. */
 	  if (i + 1 < img_info_rebase_start
-	      && cur_base + slot_size + offset >= img_info_list[i + 1].base)
-	    img_info_list[i].base = 0;
+	      && cur_base + slot_size + offset > img_info_list[i + 1].base)
+	    {
+	      img_info_list[i].base = 0;
+	      if (verbose)
+		fprintf (stderr, "rebasing %s because it won't fit in it's old slot without overlapping next DLL\n", img_info_list[i].name);
+	    }
 	  /* Does the previous DLL reach into the address space of this
 	     DLL?  This happens if the previous DLL is not rebaseable. */
 	  else if (i > 0 && cur_base < img_info_list[i - 1].base
-				       + img_info_list[i + 1].slot_size)
-	    img_info_list[i].base = 0;
+				       + img_info_list[i - 1].slot_size)
+	    {
+	      img_info_list[i].base = 0;
+	      if (verbose)
+		fprintf (stderr, "rebasing %s because previous DLL now overlaps\n", img_info_list[i].name);
+	    }
 	  /* Does the file match the base address requirements?  If not,
 	     rebase from scratch. */
-	  else if ((down_flag && cur_base + slot_size + offset >= image_base)
+	  else if ((down_flag && cur_base + slot_size + offset > image_base)
 		   || (!down_flag && cur_base < image_base))
-	    img_info_list[i].base = 0;
+	    {
+	      img_info_list[i].base = 0;
+	      if (verbose)
+		fprintf (stderr, "rebasing %s because it's base address is outside the expected area\n", img_info_list[i].name);
+	    }
 	}
       /* Unconditionally overwrite old with new size. */
       img_info_list[i].size = cur_size;
@@ -940,6 +969,8 @@ collect_image_info (const char *pathname)
     img_info_list[img_info_size].name_size = strlen (full_path) + 1;
   }
 #endif
+  if (verbose)
+    fprintf (stderr, "rebasing %s because filename given on command line\n", img_info_list[img_info_size].name);
   ++img_info_size;
   return TRUE;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.