delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/08/00:45:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 8 Jul 2005 00:44:18 -0400
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: rebaseall (temporary?) patch
Message-ID: <20050708044418.GA6431@trixie.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.5.8i

The below patch to rebaseall will avoid errors when rebasing dlls used
by the shell which is executing it.

It might be interesting to automatically write a .bat file which
performed the final step of renaming the rebased in-use dlls to their
correct names but it's too late to do that.

cgf

--- /bin/rebaseall.orig	2004-03-12 08:49:18.000000000 -0500
+++ /bin/rebaseall	2005-07-08 00:38:13.765660000 -0400
@@ -1,5 +1,4 @@
 #!/bin/bash
-
 #
 # Copyright (c) 2003 Jason Tishler
 #
@@ -33,7 +32,7 @@
 
 cleanup()
 {
-    rm -f $TmpFile
+    rm -f $TmpFile $InUseDlls
     exit 0
 }
 
@@ -87,11 +86,28 @@
 
 # Set temp file
 TmpFile=$TmpDir/rebase.lst
+InUseDlls=$TmpDir/rball.$$
+
+me=`readlink /proc/$$/exe`
+
+for f in `case "$me" in
+    *.exe) cygcheck "$me" ;;
+    *) cygcheck "$me".exe ;;
+esac`; do
+    cygpath -u $f
+done | grep -E '^/(bin|usr/bin).*\.dll' > $InUseDlls
+
+for f in `cat $InUseDlls`; do
+    case "$f" in
+	*/cygwin1.dll) ;;
+	*) cp -p $f $f.rebased;  echo $f.rebased ;;
+    esac
+done > $TmpFile
 
 # Create rebase list
 # FIXME: Remove ugly Apache hack ASAP
 zcat /etc/setup/*.lst.gz | grep 'dll$' |
-    sed -e '/cygwin1.dll$/d' -e 's/^/\//' -e 's/apache\/new/apache/' >$TmpFile
+    sed -e '/cygwin1.dll$/d' -e 's/^/\//' -e 's/apache\/new/apache/' | fgrep -v -f $InUseDlls >>$TmpFile
 
 # Append user supplied file list, if any
 if [ -n "$FileList" ]
@@ -102,5 +118,16 @@
 # Rebase files
 rebase $Verbose -d -b $BaseAddress -o $Offset -T $TmpFile
 
+if [ -s $InUseDlls ]; then
+    rename=`cygpath -w /bin/rename.exe`
+    echo "$0: Some dlls were not rebased because they were in use.
+
+Exit all cygwin processes and type:
+
+    $rename .rebased \"\" /bin/*.rebased
+
+to complete the rebaseall process"
+fi
+
 # Clean up
 cleanup

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019