From bcbc7f9768854a6e6aaf1a450cdaabc61241ea9d Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Wed, 20 Jul 2022 12:14:42 -0400 Subject: [PATCH] Make rebaseall a wrapper around the autorebase postinstall script Do this on Cygwin only; the behavior on MinGW and MSYS is unchanged. Bump version to 4.6.1. --- NEWS | 5 +++ README | 30 ++++++++-------- configure.ac | 2 +- rebaseall.in | 100 +++++++++++++++++++-------------------------------- 4 files changed, 56 insertions(+), 81 deletions(-) diff --git a/NEWS b/NEWS index f982c32..c824d5b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ $Id$ +4.6.1 +============================================================================== + * Make rebaseall a wrapper around /etc/postinstall/0p_000_autorebase.dash + (Cygwin only). + 4.3.0 ============================================================================== * Add --oblivious/-O option: do not touch files already in the diff --git a/README b/README index 6383fcf..9456b5e 100644 --- a/README +++ b/README @@ -53,9 +53,13 @@ the following will be displayed when the problem is triggered: C:\cygwin\bin\python.exe: *** unable to remap C:\cygwin\bin\cygssl.dll to same address as parent(0xDF0000) != 0xE00000 -Note that rebaseall is only a stop-gap measure. Eventually the rebase -functionality will be added to Cygwin's setup.exe, so that rebasing will -happen automatically. +On Cygwin, rebaseall has been replaced by the postinstall script +/etc/postinstall/0p_000_autorebase.dash, provided by the _autorebase +package. This script runs every time Cygwin's setup program is run. +See /usr/share/doc/Cygwin/_autorebase.README. + +For the convenience of users who may wish to rebase between runs of +setup, rebaseall is now a wrapper around that postinstall script. On Vista and newer, it is possible to employ the Address Space Layout Randomization facility to help solve the image load address clashing @@ -163,7 +167,7 @@ the next section. Command line syntax ================================================================================ -rebaseall +rebaseall (MinGW and MSYS only) -------------------------------------------------------------------------------- The following is the rebaseall command line syntax: @@ -358,31 +362,25 @@ Issues: ================================================================================ The following are the known Cygwin rebase issues: -1. rebase should be integrated with Cygwin's setup.exe. - -2. rebase does not handle in-use DLLs. +1. rebase does not handle in-use DLLs. -3. rebase skips read-only DLLs. +2. rebase skips read-only DLLs. -Issues #1, #2, and #3 also apply to the peflags utility. +These issues also apply to the peflags utility. Homepage: ================================================================================ The primary rebase web site is: - http://www.tishler.net/jason/software/rebase/ + https://cygwin.com/git/?p=cygwin-apps/rebase.git Download: ================================================================================ -The primary rebase download site is: - - http://www.tishler.net/jason/software/rebase/ - -Access to the CVS development sources is available: +Access to the git development sources is available: - cvs -d:pserver:anoncvs@cygwin.com:/cvs/cygwin-apps co rebase + git clone git://cygwin.com/git/cygwin-apps/rebase.git Mailing Lists: diff --git a/configure.ac b/configure.ac index 91415d5..f66c2a6 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # configure.ac for rebase AC_PREREQ([2.64]) -AC_INIT([rebase], [4.6.0], [cygwin@cygwin.com]) +AC_INIT([rebase], [4.6.1], [cygwin@cygwin.com]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([peflags.c]) AC_PREFIX_DEFAULT([/usr]) diff --git a/rebaseall.in b/rebaseall.in index af4fe3f..b624939 100644 --- a/rebaseall.in +++ b/rebaseall.in @@ -38,6 +38,32 @@ DefaultVerbose= DefaultFileList= DefaultSuffixes='dll|so|oct' +# Determine platform +Platform=`uname -s` +case $Platform in + *MINGW* | *mingw* ) Platform=mingw ;; + *CYGWIN* | *cygwin* ) Platform=cygwin ;; + *MSYS* | *msys* ) Platform=msys ;; + * ) + echo "Unsupported platform: $Platform" 1>&2 + exit 1 + ;; +esac + +# On Cygwin, just call the _autorebase postinstall script +case $Platform in + cygwin) + if [ "$#" -gt 0 ] + then + echo "usage: ${ProgramName}" + exit 1 + fi + exec /etc/postinstall/0p_000_autorebase.dash + ;; + *) + ;; +esac + # Define functions usage() { @@ -76,27 +102,6 @@ case `uname -m` in ;; esac -# Determine platform -Platform=`uname -s` -case $Platform in - *MINGW* | *mingw* ) Platform=mingw ;; - *CYGWIN* | *cygwin* ) Platform=cygwin ;; - *MSYS* | *msys* ) Platform=msys ;; - * ) - echo "Unsupported platform: $Platform" 1>&2 - exit 1 - ;; -esac - -# On x86_64 Cygwin, set DefaultAddressBase to 0x4:00000000 -case $Platform in - cygwin ) - [ `uname -m` = "x86_64" ] && DefaultBaseAddress=0x400000000 - ;; - * ) - ;; -esac - # Parse command line arguments while getopts "${ProgramOptions}" Option "$@" do @@ -132,9 +137,7 @@ done if [ "${check_for_dash_only}" != "no" ] then ProcessResult=0 - case $Platform in - mingw|msys ) - /bin/ps -s | /bin/gawk '\ + /bin/ps -s | /bin/gawk '\ # Count number of running ash or dash. \ /\/bin\/(d)?ash(\.exe)?$/{ ash_cnt++; } \ # Count number of ps and gawk. \ @@ -153,13 +156,7 @@ then # All is well. \ exit 1; \ }' - ProcessResult=$? - ;; - cygwin ) - grep -E -q -i -v '/d?ash(.exe)?$' /proc/[0-9]*/exename - ProcessResult=$? - ;; - esac + ProcessResult=$? if [ $ProcessResult -eq 0 -a -z "${RebaseDebug}" ] then echo "${ProgramName}: only ash or dash processes are allowed during rebasing" @@ -208,39 +205,14 @@ SortedFile="$TmpDir/rebase.lst" TmpFile="${SortedFile}.in" # Create rebase list -case $Platform in - cygwin) - find /etc/setup -name '*.lst.gz' | xargs gzip -d -c | - grep -E "\.($Suffixes)\$" | - sed -e '/\/cygwin1\.dll$/d' -e '/\/cyglsa.*\.dll$/d' \ - -e '/sys-root\/mingw/d' -e 's/^/\//' \ - -e '/\/d\?ash\.exe$/d' -e '/\/rebase\.exe$/d' >"${TmpFile}" - # some interpreters include a method for installing addons outside of the - # package manager, such as CPAN and RubyGems. - for d in /usr/lib/perl5/site_perl /usr/lib/py*/site-packages \ - /usr/lib/php /usr/lib/R/site-library /usr/lib/rub*/gems \ - /usr/lib/octave/site - do - if [ -d $d ] - then - find $d -type f | grep -E "\.($Suffixes)\$" >>"${TmpFile}" - fi - done - # Unconditionally add the -n flag so rebased DLLs get the - # dynamicbase flag removed. - NoDyn='-n' - ;; - mingw|msys) - for f in /bin /lib - do - find $f -type f | - grep -E "\.($Suffixes)\$" | - sed -e '/\/msys-1\.0.*\.dll$/d' -e '/\/cygwin1\.dll$/d' \ - -e '/\/cyglsa.*\.dll$/d' -e '/\/d\?ash\.exe$/d' \ - -e '/\/rebase\.exe$/d' >>"$TmpFile" - done - ;; -esac +for f in /bin /lib +do + find $f -type f | + grep -E "\.($Suffixes)\$" | + sed -e '/\/msys-1\.0.*\.dll$/d' -e '/\/cygwin1\.dll$/d' \ + -e '/\/cyglsa.*\.dll$/d' -e '/\/d\?ash\.exe$/d' \ + -e '/\/rebase\.exe$/d' >>"$TmpFile" +done # Append user supplied file list, if any if [ -n "${FileList}" ] -- 2.37.1