public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [rebase - The rebase tool, core of the automatic rebase facility during postinstall] branch master, updated. 1def5794ab48d0eae1589378df79714d8ff755d7
Date: Tue, 13 Feb 2018 12:47:00 -0000	[thread overview]
Message-ID: <20180213124753.13228.qmail@sourceware.org> (raw)




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

commit 1def5794ab48d0eae1589378df79714d8ff755d7
Author: Jon Turney <jon.turney@dronecode.org.uk>
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 <jon.turney@dronecode.org.uk>
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;
 }


                 reply	other threads:[~2018-02-13 12:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180213124753.13228.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).