aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2011-12-28 15:37:52 -0500
committerAnthony G. Basile <blueness@gentoo.org>2011-12-28 19:59:10 -0500
commitf53c687ad69a82de7f03c753a8afd4094d1322e5 (patch)
tree30584bba5e16dc9564ea4e7f34d55d0a297b98e0
parentmisc/test-revdep-pax/testrevdeppax.sh: added test script (diff)
downloadelfix-f53c687ad69a82de7f03c753a8afd4094d1322e5.tar.gz
elfix-f53c687ad69a82de7f03c753a8afd4094d1322e5.tar.bz2
elfix-f53c687ad69a82de7f03c753a8afd4094d1322e5.zip
scripts/revdep-pax: added an allyes option
-rw-r--r--doc/revdep-pax.116
-rw-r--r--doc/revdep-pax.pod16
-rwxr-xr-xscripts/revdep-pax44
3 files changed, 47 insertions, 29 deletions
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 3d2974c..698e90c 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -137,11 +137,11 @@ revdep\-pax \- find mismatching PaX markings between ELF objects and their libra
.PP
\&\fBrevdep-pax\fR \-r [\-ve]
.PP
-\&\fBrevdep-pax\fR \-b \s-1OBJECT\s0 [\-mv]
+\&\fBrevdep-pax\fR \-b \s-1OBJECT\s0 [\-myv]
.PP
-\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-mve]
+\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-myve]
.PP
-\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-mve]
+\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-myve]
.PP
\&\fBrevdep-pax\fR [\-h]
.SH "DESCRIPTION"
@@ -181,9 +181,6 @@ so that the PaX flags of the target inherit the flags of the source.
.IP "\fB\-l\fR \s-1LIBRARY\s0 Retrieve only the reverse mappings for this \s-1LIBRARY\s0." 4
.IX Item "-l LIBRARY Retrieve only the reverse mappings for this LIBRARY."
.IP "" 4
-.IP "\fB\-m\fR Prompt the user to mark the found object with the PaX flags of the source." 4
-.IX Item "-m Prompt the user to mark the found object with the PaX flags of the source."
-.IP "" 4
.IP "\fB\-v\fR Report all mappings, not just the mismatched ones." 4
.IX Item "-v Report all mappings, not just the mismatched ones."
.IP "" 4
@@ -191,6 +188,13 @@ so that the PaX flags of the target inherit the flags of the source.
.el .IP "\fB\-e\fR Limit the markings or report to only those executables in the current shell's \f(CW$PATH\fR." 4
.IX Item "-e Limit the markings or report to only those executables in the current shell's $PATH."
.IP "" 4
+.IP "\fB\-m\fR Prompt the user to mark the found object with the PaX flags of the source." 4
+.IX Item "-m Prompt the user to mark the found object with the PaX flags of the source."
+.IP "" 4
+.ie n .IP "\fB\-y\fR Assume ""yes"" to all prompts for making (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.el .IP "\fB\-y\fR Assume ``yes'' to all prompts for making (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.IX Item "-y Assume yes to all prompts for making (USE CAREFULLY!)"
+.IP "" 4
.IP "\fB\-h\fR Print out a short help message and exit." 4
.IX Item "-h Print out a short help message and exit."
.PD
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index 03ff277..19bf750 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -8,11 +8,11 @@ B<revdep-pax> -f [-v]
B<revdep-pax> -r [-ve]
-B<revdep-pax> -b OBJECT [-mv]
+B<revdep-pax> -b OBJECT [-myv]
-B<revdep-pax> -s SONAME [-mve]
+B<revdep-pax> -s SONAME [-myve]
-B<revdep-pax> -l LIBRARY [-mve]
+B<revdep-pax> -l LIBRARY [-myve]
B<revdep-pax> [-h]
@@ -60,15 +60,19 @@ so that the PaX flags of the target inherit the flags of the source.
=item
-=item B<-m> Prompt the user to mark the found object with the PaX flags of the source.
+=item B<-v> Report all mappings, not just the mismatched ones.
=item
-=item B<-v> Report all mappings, not just the mismatched ones.
+=item B<-e> Limit the markings or report to only those executables in the current shell's $PATH.
=item
-=item B<-e> Limit the markings or report to only those executables in the current shell's $PATH.
+=item B<-m> Prompt the user to mark the found object with the PaX flags of the source.
+
+=item
+
+=item B<-y> Assume "yes" to all prompts for making (USE CAREFULLY!)
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index be6a387..e22d3a7 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -228,7 +228,7 @@ def migrate_flags(importer, exporter_str_flags, exporter_bin_flags):
pax.setflags(importer, result_bin_flags)
-def run_binary(binary, verbose, mark):
+def run_binary(binary, verbose, mark, allyes):
( linkings, mappings ) = get_ldd_linkings(binary)
( binary_str_flags, binary_bin_flags ) = pax.getflags(binary)
print '%s (%s)\n' % ( binary, binary_str_flags )
@@ -259,7 +259,10 @@ def run_binary(binary, verbose, mark):
for library in mismatched_libraries:
do_marking = False
while True:
- ans = raw_input('\tSet flags for %s (y/n): ' % library)
+ if allyes:
+ ans = 'y'
+ else:
+ ans = raw_input('\tSet flags for %s (y/n): ' % library)
if ans == 'y':
do_marking = True
break
@@ -286,7 +289,7 @@ def invert_so2library_mappings( so2library_mappings ):
return library2soname_mappings
-def run_soname(name, verbose, use_soname, mark, executable_only):
+def run_soname(name, verbose, use_soname, mark, allyes, executable_only):
shell_path = path = os.getenv('PATH').split(':')
( forward_linkings, so2library_mappings ) = get_forward_linkings()
@@ -340,7 +343,10 @@ def run_soname(name, verbose, use_soname, mark, executable_only):
continue
do_marking = False
while True:
- ans = raw_input('\tSet flags for %s (y/n): ' % binary)
+ if allyes:
+ ans = 'y'
+ else:
+ ans = raw_input('\tSet flags for %s (y/n): ' % binary)
if ans == 'y':
do_marking = True
break
@@ -365,21 +371,22 @@ def run_usage():
print 'Program Name : revdep-pax'
print 'Description : Get or set pax flags on an ELF object'
print
- print 'Usage : revdep-pax -f [-v] print out all forward mappings for all system binaries'
- print ' : revdep-pax -r [-ve] print out all reverse mappings for all system sonames'
- print ' : revdep-pax -b OBJECT [-mv] print all forward mappings only for OBJECT'
- print ' : revdep-pax -s SONAME [-mve] print all reverse mappings only for SONAME'
- print ' : revdep-pax -l LIBRARY [-mve] print all reverse mappings only for LIBRARY file'
- print ' : revdep-pax [-h] print out this help'
- print ' : -v verbose, otherwise just print mismatching objects'
- print ' : -e only print out executables in shell $PATH'
- print ' : -m don\'t just report, but mark the mismatching objects'
+ print 'Usage : revdep-pax -f [-v] print out all forward mappings for all system binaries'
+ print ' : revdep-pax -r [-ve] print out all reverse mappings for all system sonames'
+ print ' : revdep-pax -b OBJECT [-myv] print all forward mappings only for OBJECT'
+ print ' : revdep-pax -s SONAME [-myve] print all reverse mappings only for SONAME'
+ print ' : revdep-pax -l LIBRARY [-myve] print all reverse mappings only for LIBRARY file'
+ print ' : revdep-pax [-h] print out this help'
+ print ' : -v verbose, otherwise just print mismatching objects'
+ print ' : -e only print out executables in shell $PATH'
+ print ' : -m don\'t just report, but mark the mismatching objects'
+ print ' : -y assume "yes" to all prompts for making (USE CAREFULLY!)'
print
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vem')
+ opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vemy')
except getopt.GetoptError, err:
print str(err) # will print something like 'option -a not recognized'
run_usage()
@@ -400,6 +407,7 @@ def main():
verbose = False
executable_only = False
mark = False
+ allyes = False
opt_count = 0
@@ -428,6 +436,8 @@ def main():
executable_only = True
elif o == '-m':
mark = True
+ elif o == '-y':
+ allyes = True
else:
print 'Option included in getopt but not handled here!'
print 'Please file a bug'
@@ -442,18 +452,18 @@ def main():
run_reverse(verbose, executable_only)
elif binary != None:
try:
- run_binary(binary, verbose, mark)
+ run_binary(binary, verbose, mark, allyes)
except:
print 'Please check that %s exists!' % binary
elif soname != None:
try:
- run_soname(soname, verbose, True, mark, executable_only)
+ run_soname(soname, verbose, True, mark, allyes, executable_only)
except:
print 'Please check that %s exists!' % soname
elif library != None:
try:
library = os.path.realpath(library)
- run_soname(library, verbose, False, mark, executable_only)
+ run_soname(library, verbose, False, mark, allyes, executable_only)
except:
print 'Please check that %s exists!' % library