* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2011-11-26 18:43 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2011-11-26 18:43 UTC (permalink / raw
To: gentoo-commits
commit: f85a9ba0fc729d43fdf240da7d075eaaa09c6b62
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 26 18:42:59 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Nov 26 18:42:59 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=f85a9ba0
scripts/revdep-pax: add -e switch, verbose for ~/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3:/usr/lib64/subversion/bin:/usr/games/bin only
---
doc/revdep-pax.1 | 36 +++++++++++++++------------
doc/revdep-pax.pod | 24 ++++++++++-------
scripts/revdep-pax | 68 ++++++++++++++++++++++++++++-----------------------
3 files changed, 71 insertions(+), 57 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 8e2b008..3933f76 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -135,13 +135,13 @@ revdep\-pax \- find mismatching PaX markings between ELF objects and their libra
.IX Header "SYNOPSIS"
\&\fBrevdep-pax\fR \-f [\-v]
.PP
-\&\fBrevdep-pax\fR \-r [\-v]
+\&\fBrevdep-pax\fR \-r [\-ve]
.PP
\&\fBrevdep-pax\fR \-b \s-1OBJECT\s0 [\-mv]
.PP
-\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-mv]
+\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-mve]
.PP
-\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-mv]
+\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-mve]
.PP
\&\fBrevdep-pax\fR [\-h]
.SH "DESCRIPTION"
@@ -165,28 +165,32 @@ and in mark mode (\-m), the user is prompted whether to proceed with the migrati
so that the PaX flags of the target inherit the flags of the source.
.SH "OPTIONS"
.IX Header "OPTIONS"
-.IP "\fB\-f\fR Scan the system for all forward mappings" 4
-.IX Item "-f Scan the system for all forward mappings"
+.IP "\fB\-f\fR Scan the system for all forward mappings." 4
+.IX Item "-f Scan the system for all forward mappings."
.PD 0
.IP "" 4
-.IP "\fB\-r\fR Scan the system for all reverse mappings" 4
-.IX Item "-r Scan the system for all reverse mappings"
+.IP "\fB\-r\fR Scan the system for all reverse mappings." 4
+.IX Item "-r Scan the system for all reverse mappings."
.IP "" 4
-.IP "\fB\-b\fR \s-1OBJECT\s0 Retrieve only the forward mappings for this \s-1ELF\s0 \s-1OBJECT\s0" 4
-.IX Item "-b OBJECT Retrieve only the forward mappings for this ELF OBJECT"
+.IP "\fB\-b\fR \s-1OBJECT\s0 Retrieve only the forward mappings for this \s-1ELF\s0 \s-1OBJECT\s0." 4
+.IX Item "-b OBJECT Retrieve only the forward mappings for this ELF OBJECT."
.IP "" 4
-.IP "\fB\-s\fR \s-1SONAME\s0 Retrieve only the reverse mappings for this \s-1SONAME\s0" 4
-.IX Item "-s SONAME Retrieve only the reverse mappings for this SONAME"
+.IP "\fB\-s\fR \s-1SONAME\s0 Retrieve only the reverse mappings for this \s-1SONAME\s0." 4
+.IX Item "-s SONAME Retrieve only the reverse mappings for this SONAME."
.IP "" 4
-.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\-v\fR Report all mappings, not just the mismatched ones" 4
-.IX Item "-v Report all mappings, not just the mismatched ones"
+.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
+.ie n .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's $PATH. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.el .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's \f(CW$PATH\fR. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.IX Item "-e If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
+.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 fc46418..a72b0ba 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -6,13 +6,13 @@ B<revdep-pax> - find mismatching PaX markings between ELF objects and their libr
B<revdep-pax> -f [-v]
-B<revdep-pax> -r [-v]
+B<revdep-pax> -r [-ve]
B<revdep-pax> -b OBJECT [-mv]
-B<revdep-pax> -s SONAME [-mv]
+B<revdep-pax> -s SONAME [-mve]
-B<revdep-pax> -l LIBRARY [-mv]
+B<revdep-pax> -l LIBRARY [-mve]
B<revdep-pax> [-h]
@@ -40,31 +40,35 @@ so that the PaX flags of the target inherit the flags of the source.
=over
-=item B<-f> Scan the system for all forward mappings
+=item B<-f> Scan the system for all forward mappings.
=item
-=item B<-r> Scan the system for all reverse mappings
+=item B<-r> Scan the system for all reverse mappings.
=item
-=item B<-b> OBJECT Retrieve only the forward mappings for this ELF OBJECT
+=item B<-b> OBJECT Retrieve only the forward mappings for this ELF OBJECT.
=item
-=item B<-s> SONAME Retrieve only the reverse mappings for this SONAME
+=item B<-s> SONAME Retrieve only the reverse mappings for this SONAME.
=item
-=item B<-l> LIBRARY Retrieve only the reverse mappings for this LIBRARY
+=item B<-l> LIBRARY Retrieve only the reverse mappings for this LIBRARY.
=item
-=item B<-v> Report all mappings, not just the mismatched ones
+=item B<-m> Prompt the user to mark the found object with the PaX 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<-e> If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index bfea494..b65a65a 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -105,13 +105,10 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
print sv
print
if count == 0:
- print
print '\tNo mismatches'
- print
else:
- print
print '\tMismatches'
- print
+ print
else:
if count != 0:
print s
@@ -120,14 +117,12 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
missing_binaries = set(missing_binaries)
print
- print
print '**** Missing binaries ****'
for m in missing_binaries:
print m
missing_links = set(missing_links)
print
- print
print '**** Missing forward linkings ****'
for m in missing_links:
print m
@@ -136,7 +131,8 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
print
-def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
+def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only ):
+ shell_path = path = os.getenv('PATH').split(':')
missing_sonames = []
missing_links = []
@@ -155,7 +151,11 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
for binary in reverse_linkings[soname]:
try:
( binary_flags, binary_pax_flags ) = pax.getflags(binary)
- sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
+ if executable_only:
+ if os.path.dirname(binary) in shell_path:
+ sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
+ else:
+ sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
if library_flags != binary_flags:
s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags )
count = count + 1
@@ -166,13 +166,10 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
print sv
print
if count == 0:
- print
print '\tNo mismatches'
- print
else:
- print
print '\tMismatches'
- print
+ print
else:
if count != 0:
print s
@@ -181,17 +178,16 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
missing_sonames = set(missing_sonames)
print
- print
print '**** Missing sonames ****'
for m in missing_sonames:
print m
missing_links = set(missing_links)
print
- print
print '**** Missing reverse linkings ****'
for m in missing_links:
print m
+
print
print
@@ -202,14 +198,15 @@ 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 [-v] print out all reverse mappints for all system sonames'
- print ' : revdep-pax -b OBJECT [-mv] print all forward mappings only for OBJECT'
- print ' : revdep-pax -s SONAME [-mv] print all reverse mappings only for SONAME'
- print ' : revdep-pax -l LIBRARY [-mv] 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 ' : -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 [-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 assuming verbose, only print out executables in shell $PATH'
+ print ' : -m don\'t just report, but mark the mismatching objects'
print
@@ -219,10 +216,10 @@ def run_forward(verbose):
print
-def run_reverse(verbose):
+def run_reverse(verbose, executable_only):
( forward_linkings, so2library_mappings ) = get_forward_linkings()
reverse_linkings = invert_linkings( forward_linkings )
- print_reverse_linkings( reverse_linkings, so2library_mappings, verbose )
+ print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only)
print
@@ -285,7 +282,9 @@ def invert_so2library_mappings( so2library_mappings ):
return library2soname_mappings
-def run_soname(name, verbose, use_soname, mark):
+def run_soname(name, verbose, use_soname, executable_only, mark):
+ shell_path = path = os.getenv('PATH').split(':')
+
( forward_linkings, so2library_mappings ) = get_forward_linkings()
reverse_linkings = invert_linkings( forward_linkings )
@@ -299,7 +298,7 @@ def run_soname(name, verbose, use_soname, mark):
library = so2library_mappings[soname]
( library_flags, library_pax_flags ) = pax.getflags(library)
- print soname, '\t', library, '(', library_flags, ')'
+ print '%s\t%s (%s)' % ( soname, library, library_flags )
print
mismatched_binaries = []
@@ -307,7 +306,11 @@ def run_soname(name, verbose, use_soname, mark):
try:
( binary_flags, binary_pax_flags ) = pax.getflags(binary)
if verbose:
- print '\t%s ( %s )' % ( binary, binary_flags )
+ if executable_only:
+ if os.path.dirname(binary) in shell_path:
+ print '\t%s ( %s )' % ( binary, binary_flags )
+ else:
+ print '\t%s ( %s )' % ( binary, binary_flags )
if library_flags != binary_flags:
mismatched_binaries.append(binary)
if not verbose:
@@ -347,7 +350,7 @@ def run_soname(name, verbose, use_soname, mark):
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vm')
+ opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vem')
except getopt.GetoptError, err:
print str(err) # will print something like 'option -a not recognized'
run_usage()
@@ -366,6 +369,7 @@ def main():
library = None
verbose = False
+ executable_only = False
mark = False
opt_count = 0
@@ -391,6 +395,8 @@ def main():
opt_count += 1
elif o == '-v':
verbose = True
+ elif o == '-e':
+ executable_only = True
elif o == '-m':
mark = True
else:
@@ -404,14 +410,14 @@ def main():
elif do_forward:
run_forward(verbose)
elif do_reverse:
- run_reverse(verbose)
+ run_reverse(verbose, executable_only)
elif binary != None:
run_binary(binary, verbose, mark)
elif soname != None:
- run_soname(soname, verbose, True, mark)
+ run_soname(soname, verbose, executable_only, True, mark)
elif library != None:
library = os.path.realpath(library)
- run_soname(library, verbose, False, mark)
+ run_soname(library, verbose, executable_only, False, mark)
if __name__ == '__main__':
main()
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2011-11-26 18:51 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2011-11-26 18:51 UTC (permalink / raw
To: gentoo-commits
commit: 705e0bb15c17788b30042f1267179727a834d485
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 26 18:51:14 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Nov 26 18:51:14 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=705e0bb1
Improved readability of doc/revdep-pax.1 and scripts/revdep-pax
---
doc/revdep-pax.1 | 10 +++++-----
doc/revdep-pax.pod | 2 +-
scripts/revdep-pax | 36 ++++++++++++++++++------------------
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 3933f76..b991d90 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -181,15 +181,15 @@ 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 "\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
-.ie n .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's $PATH. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
-.el .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's \f(CW$PATH\fR. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
-.IX Item "-e If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
+.ie n .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's $PATH. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.el .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's \f(CW$PATH\fR. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.IX Item "-e If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
.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."
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index a72b0ba..98175bd 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -68,7 +68,7 @@ so that the PaX flags of the target inherit the flags of the source.
=item
-=item B<-e> If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
+=item B<-e> If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index b65a65a..827d700 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -192,24 +192,6 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, exec
print
-def run_usage():
- print 'Package Name : elfix'
- print 'Bug Reports : http://bugs.gentoo.org/'
- 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 assuming verbose, only print out executables in shell $PATH'
- print ' : -m don\'t just report, but mark the mismatching objects'
- print
-
-
def run_forward(verbose):
( forward_linkings, so2library_mappings ) = get_forward_linkings()
print_forward_linkings( forward_linkings, so2library_mappings, verbose)
@@ -348,6 +330,24 @@ def run_soname(name, verbose, use_soname, executable_only, mark):
print
+def run_usage():
+ print 'Package Name : elfix'
+ print 'Bug Reports : http://bugs.gentoo.org/'
+ 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 assuming verbose, only print out executables in shell $PATH'
+ print ' : -m don\'t just report, but mark the mismatching objects'
+ print
+
+
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vem')
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2011-11-26 19:08 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2011-11-26 19:08 UTC (permalink / raw
To: gentoo-commits
commit: e22b2cc3603fbe67808985168837b744cdd6fa68
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 26 18:51:14 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Nov 26 19:08:35 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=e22b2cc3
Improved readability of doc/revdep-pax.1 and scripts/revdep-pax
---
doc/revdep-pax.1 | 10 +++++-----
doc/revdep-pax.pod | 2 +-
scripts/revdep-pax | 36 ++++++++++++++++++------------------
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 3933f76..b991d90 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -181,15 +181,15 @@ 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 "\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
-.ie n .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's $PATH. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
-.el .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's \f(CW$PATH\fR. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
-.IX Item "-e If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
+.ie n .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's $PATH. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.el .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's \f(CW$PATH\fR. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.IX Item "-e If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
.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."
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index a72b0ba..98175bd 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -68,7 +68,7 @@ so that the PaX flags of the target inherit the flags of the source.
=item
-=item B<-e> If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
+=item B<-e> If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index b65a65a..827d700 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -192,24 +192,6 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, exec
print
-def run_usage():
- print 'Package Name : elfix'
- print 'Bug Reports : http://bugs.gentoo.org/'
- 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 assuming verbose, only print out executables in shell $PATH'
- print ' : -m don\'t just report, but mark the mismatching objects'
- print
-
-
def run_forward(verbose):
( forward_linkings, so2library_mappings ) = get_forward_linkings()
print_forward_linkings( forward_linkings, so2library_mappings, verbose)
@@ -348,6 +330,24 @@ def run_soname(name, verbose, use_soname, executable_only, mark):
print
+def run_usage():
+ print 'Package Name : elfix'
+ print 'Bug Reports : http://bugs.gentoo.org/'
+ 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 assuming verbose, only print out executables in shell $PATH'
+ print ' : -m don\'t just report, but mark the mismatching objects'
+ print
+
+
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vem')
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2011-11-26 19:08 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2011-11-26 19:08 UTC (permalink / raw
To: gentoo-commits
commit: a4151124982b199eddd55eb103ddb287fd3f8571
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 26 18:42:59 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Nov 26 19:08:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=a4151124
scripts/revdep-pax: add -e switch, verbose for shell PATH
---
doc/revdep-pax.1 | 36 +++++++++++++++------------
doc/revdep-pax.pod | 24 ++++++++++-------
scripts/revdep-pax | 68 ++++++++++++++++++++++++++++-----------------------
3 files changed, 71 insertions(+), 57 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 8e2b008..3933f76 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -135,13 +135,13 @@ revdep\-pax \- find mismatching PaX markings between ELF objects and their libra
.IX Header "SYNOPSIS"
\&\fBrevdep-pax\fR \-f [\-v]
.PP
-\&\fBrevdep-pax\fR \-r [\-v]
+\&\fBrevdep-pax\fR \-r [\-ve]
.PP
\&\fBrevdep-pax\fR \-b \s-1OBJECT\s0 [\-mv]
.PP
-\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-mv]
+\&\fBrevdep-pax\fR \-s \s-1SONAME\s0 [\-mve]
.PP
-\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-mv]
+\&\fBrevdep-pax\fR \-l \s-1LIBRARY\s0 [\-mve]
.PP
\&\fBrevdep-pax\fR [\-h]
.SH "DESCRIPTION"
@@ -165,28 +165,32 @@ and in mark mode (\-m), the user is prompted whether to proceed with the migrati
so that the PaX flags of the target inherit the flags of the source.
.SH "OPTIONS"
.IX Header "OPTIONS"
-.IP "\fB\-f\fR Scan the system for all forward mappings" 4
-.IX Item "-f Scan the system for all forward mappings"
+.IP "\fB\-f\fR Scan the system for all forward mappings." 4
+.IX Item "-f Scan the system for all forward mappings."
.PD 0
.IP "" 4
-.IP "\fB\-r\fR Scan the system for all reverse mappings" 4
-.IX Item "-r Scan the system for all reverse mappings"
+.IP "\fB\-r\fR Scan the system for all reverse mappings." 4
+.IX Item "-r Scan the system for all reverse mappings."
.IP "" 4
-.IP "\fB\-b\fR \s-1OBJECT\s0 Retrieve only the forward mappings for this \s-1ELF\s0 \s-1OBJECT\s0" 4
-.IX Item "-b OBJECT Retrieve only the forward mappings for this ELF OBJECT"
+.IP "\fB\-b\fR \s-1OBJECT\s0 Retrieve only the forward mappings for this \s-1ELF\s0 \s-1OBJECT\s0." 4
+.IX Item "-b OBJECT Retrieve only the forward mappings for this ELF OBJECT."
.IP "" 4
-.IP "\fB\-s\fR \s-1SONAME\s0 Retrieve only the reverse mappings for this \s-1SONAME\s0" 4
-.IX Item "-s SONAME Retrieve only the reverse mappings for this SONAME"
+.IP "\fB\-s\fR \s-1SONAME\s0 Retrieve only the reverse mappings for this \s-1SONAME\s0." 4
+.IX Item "-s SONAME Retrieve only the reverse mappings for this SONAME."
.IP "" 4
-.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\-v\fR Report all mappings, not just the mismatched ones" 4
-.IX Item "-v Report all mappings, not just the mismatched ones"
+.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
+.ie n .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's $PATH. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.el .IP "\fB\-e\fR If \-v is chosen, then limit the report to only those executables in the current shell's \f(CW$PATH\fR. If \-m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
+.IX Item "-e If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
+.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 fc46418..a72b0ba 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -6,13 +6,13 @@ B<revdep-pax> - find mismatching PaX markings between ELF objects and their libr
B<revdep-pax> -f [-v]
-B<revdep-pax> -r [-v]
+B<revdep-pax> -r [-ve]
B<revdep-pax> -b OBJECT [-mv]
-B<revdep-pax> -s SONAME [-mv]
+B<revdep-pax> -s SONAME [-mve]
-B<revdep-pax> -l LIBRARY [-mv]
+B<revdep-pax> -l LIBRARY [-mve]
B<revdep-pax> [-h]
@@ -40,31 +40,35 @@ so that the PaX flags of the target inherit the flags of the source.
=over
-=item B<-f> Scan the system for all forward mappings
+=item B<-f> Scan the system for all forward mappings.
=item
-=item B<-r> Scan the system for all reverse mappings
+=item B<-r> Scan the system for all reverse mappings.
=item
-=item B<-b> OBJECT Retrieve only the forward mappings for this ELF OBJECT
+=item B<-b> OBJECT Retrieve only the forward mappings for this ELF OBJECT.
=item
-=item B<-s> SONAME Retrieve only the reverse mappings for this SONAME
+=item B<-s> SONAME Retrieve only the reverse mappings for this SONAME.
=item
-=item B<-l> LIBRARY Retrieve only the reverse mappings for this LIBRARY
+=item B<-l> LIBRARY Retrieve only the reverse mappings for this LIBRARY.
=item
-=item B<-v> Report all mappings, not just the mismatched ones
+=item B<-m> Prompt the user to mark the found object with the PaX 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<-e> If -v is chosen, then limit the report to only those executables in the current shell's $PATH. If -m is chosen, then limit the markings to only those executables. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index bfea494..b65a65a 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -105,13 +105,10 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
print sv
print
if count == 0:
- print
print '\tNo mismatches'
- print
else:
- print
print '\tMismatches'
- print
+ print
else:
if count != 0:
print s
@@ -120,14 +117,12 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
missing_binaries = set(missing_binaries)
print
- print
print '**** Missing binaries ****'
for m in missing_binaries:
print m
missing_links = set(missing_links)
print
- print
print '**** Missing forward linkings ****'
for m in missing_links:
print m
@@ -136,7 +131,8 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
print
-def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
+def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only ):
+ shell_path = path = os.getenv('PATH').split(':')
missing_sonames = []
missing_links = []
@@ -155,7 +151,11 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
for binary in reverse_linkings[soname]:
try:
( binary_flags, binary_pax_flags ) = pax.getflags(binary)
- sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
+ if executable_only:
+ if os.path.dirname(binary) in shell_path:
+ sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
+ else:
+ sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
if library_flags != binary_flags:
s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags )
count = count + 1
@@ -166,13 +166,10 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
print sv
print
if count == 0:
- print
print '\tNo mismatches'
- print
else:
- print
print '\tMismatches'
- print
+ print
else:
if count != 0:
print s
@@ -181,17 +178,16 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose ):
missing_sonames = set(missing_sonames)
print
- print
print '**** Missing sonames ****'
for m in missing_sonames:
print m
missing_links = set(missing_links)
print
- print
print '**** Missing reverse linkings ****'
for m in missing_links:
print m
+
print
print
@@ -202,14 +198,15 @@ 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 [-v] print out all reverse mappints for all system sonames'
- print ' : revdep-pax -b OBJECT [-mv] print all forward mappings only for OBJECT'
- print ' : revdep-pax -s SONAME [-mv] print all reverse mappings only for SONAME'
- print ' : revdep-pax -l LIBRARY [-mv] 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 ' : -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 [-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 assuming verbose, only print out executables in shell $PATH'
+ print ' : -m don\'t just report, but mark the mismatching objects'
print
@@ -219,10 +216,10 @@ def run_forward(verbose):
print
-def run_reverse(verbose):
+def run_reverse(verbose, executable_only):
( forward_linkings, so2library_mappings ) = get_forward_linkings()
reverse_linkings = invert_linkings( forward_linkings )
- print_reverse_linkings( reverse_linkings, so2library_mappings, verbose )
+ print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only)
print
@@ -285,7 +282,9 @@ def invert_so2library_mappings( so2library_mappings ):
return library2soname_mappings
-def run_soname(name, verbose, use_soname, mark):
+def run_soname(name, verbose, use_soname, executable_only, mark):
+ shell_path = path = os.getenv('PATH').split(':')
+
( forward_linkings, so2library_mappings ) = get_forward_linkings()
reverse_linkings = invert_linkings( forward_linkings )
@@ -299,7 +298,7 @@ def run_soname(name, verbose, use_soname, mark):
library = so2library_mappings[soname]
( library_flags, library_pax_flags ) = pax.getflags(library)
- print soname, '\t', library, '(', library_flags, ')'
+ print '%s\t%s (%s)' % ( soname, library, library_flags )
print
mismatched_binaries = []
@@ -307,7 +306,11 @@ def run_soname(name, verbose, use_soname, mark):
try:
( binary_flags, binary_pax_flags ) = pax.getflags(binary)
if verbose:
- print '\t%s ( %s )' % ( binary, binary_flags )
+ if executable_only:
+ if os.path.dirname(binary) in shell_path:
+ print '\t%s ( %s )' % ( binary, binary_flags )
+ else:
+ print '\t%s ( %s )' % ( binary, binary_flags )
if library_flags != binary_flags:
mismatched_binaries.append(binary)
if not verbose:
@@ -347,7 +350,7 @@ def run_soname(name, verbose, use_soname, mark):
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vm')
+ opts, args = getopt.getopt(sys.argv[1:], 'hfrb:s:l:vem')
except getopt.GetoptError, err:
print str(err) # will print something like 'option -a not recognized'
run_usage()
@@ -366,6 +369,7 @@ def main():
library = None
verbose = False
+ executable_only = False
mark = False
opt_count = 0
@@ -391,6 +395,8 @@ def main():
opt_count += 1
elif o == '-v':
verbose = True
+ elif o == '-e':
+ executable_only = True
elif o == '-m':
mark = True
else:
@@ -404,14 +410,14 @@ def main():
elif do_forward:
run_forward(verbose)
elif do_reverse:
- run_reverse(verbose)
+ run_reverse(verbose, executable_only)
elif binary != None:
run_binary(binary, verbose, mark)
elif soname != None:
- run_soname(soname, verbose, True, mark)
+ run_soname(soname, verbose, executable_only, True, mark)
elif library != None:
library = os.path.realpath(library)
- run_soname(library, verbose, False, mark)
+ run_soname(library, verbose, executable_only, False, mark)
if __name__ == '__main__':
main()
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2011-11-29 4:19 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2011-11-29 4:19 UTC (permalink / raw
To: gentoo-commits
commit: 9e7b34d3ae586ca8d0aa9419282b23702e34ecb6
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 29 04:19:34 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Nov 29 04:19:34 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=9e7b34d3
scripts/revdep-pax: -e works with both -v and not -v
---
doc/revdep-pax.1 | 6 ++--
doc/revdep-pax.pod | 2 +-
scripts/revdep-pax | 90 +++++++++++++++++++++++-----------------------------
3 files changed, 44 insertions(+), 54 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index b991d90..3d2974c 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -187,9 +187,9 @@ so that the PaX flags of the target inherit the flags of the source.
.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
-.ie n .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's $PATH. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
-.el .IP "\fB\-e\fR If \-m is chosen, then limit the markings to only those executables in the current shell's \f(CW$PATH\fR. If \-v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for \-r, \-s or \-l." 4
-.IX Item "-e If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l."
+.ie n .IP "\fB\-e\fR Limit the markings or report to only those executables in the current shell's $PATH." 4
+.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\-h\fR Print out a short help message and exit." 4
.IX Item "-h Print out a short help message and exit."
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index 98175bd..03ff277 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -68,7 +68,7 @@ so that the PaX flags of the target inherit the flags of the source.
=item
-=item B<-e> If -m is chosen, then limit the markings to only those executables in the current shell's $PATH. If -v is chosen, then similarly limit the report. This flag only has effect for reverse mappings, i.e., for -r, -s or -l.
+=item B<-e> Limit the markings or report to only those executables in the current shell's $PATH.
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index fdc96fe..42a71fd 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -83,7 +83,7 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
try:
( binary_flags, binary_pax_flags ) = pax.getflags(binary)
- sv = '%s ( %s )' % ( binary, binary_flags )
+ sv = '%s ( %s )\n' % ( binary, binary_flags )
s = sv
except:
missing_binaries.append(binary)
@@ -102,31 +102,25 @@ def print_forward_linkings( forward_linkings, so2library_mappings, verbose ):
missing_links.append(soname)
if verbose:
- print sv
- print
+ print '%s\n' % sv
if count == 0:
- print '\tNo mismatches'
+ print '\tNo mismatches\n\n'
else:
- print '\tMismatches'
- print
+ print '\tMismatches\n\n'
else:
if count != 0:
- print s
- print
+ print '%s\n\n' % s
missing_binaries = set(missing_binaries)
- print
- print '**** Missing binaries ****'
+ print '\n**** Missing binaries ****\n'
for m in missing_binaries:
- print m
+ print '\t%s' % m
+ print
missing_links = set(missing_links)
- print
- print '**** Missing forward linkings ****'
+ print '\n**** Missing forward linkings ****\n'
for m in missing_links:
- print m
-
- print
+ print '\t%s' % m
print
@@ -136,11 +130,10 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, exec
missing_links = []
for soname in reverse_linkings:
-
try:
library = so2library_mappings[soname]
( library_flags, library_pax_flags ) = pax.getflags(library)
- sv = '%s\t%s ( %s )' % ( soname, library, library_flags )
+ sv = '%s\t%s ( %s )\n' % ( soname, library, library_flags )
s = sv
except:
missing_sonames.append(soname)
@@ -153,54 +146,49 @@ def print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, exec
if executable_only:
if os.path.dirname(binary) in shell_path:
sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
+ if library_flags != binary_flags:
+ s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags )
+ count = count + 1
else:
sv = '%s\n\t%s ( %s )' % ( sv, binary, binary_flags )
- if library_flags != binary_flags:
- s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags )
- count = count + 1
+ if library_flags != binary_flags:
+ s = '%s\n\t%s ( %s )' % ( s, binary, binary_flags )
+ count = count + 1
except:
missing_links.append(binary)
if verbose:
- print sv
- print
+ print '%s\n' % sv
if count == 0:
- print '\tNo mismatches'
+ print '\tNo mismatches\n\n'
else:
- print '\tMismatches'
- print
+ print '\tMismatches\n\n'
else:
if count != 0:
- print s
- print
+ print '%s\n\n' % s
missing_sonames = set(missing_sonames)
- print
- print '**** Missing sonames ****'
+ print '\n**** Missing sonames ****\n'
for m in missing_sonames:
- print m
+ print '\t%s' % m
+ print
missing_links = set(missing_links)
- print
- print '**** Missing reverse linkings ****'
+ print '\n**** Missing reverse linkings ****\n'
for m in missing_links:
- print m
-
- print
+ print '\t%s' % m
print
def run_forward(verbose):
( forward_linkings, so2library_mappings ) = get_forward_linkings()
print_forward_linkings( forward_linkings, so2library_mappings, verbose)
- print
def run_reverse(verbose, executable_only):
( forward_linkings, so2library_mappings ) = get_forward_linkings()
reverse_linkings = invert_linkings( forward_linkings )
print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only)
- print
def run_binary(binary, verbose, mark):
@@ -225,13 +213,11 @@ def run_binary(binary, verbose, mark):
print 'file for soname %s not found' % soname
if len(mismatched_libraries) == 0:
- print
- print '\tNo mismatches'
+ if not verbose:
+ print '\tNo mismatches'
print
else:
print
- print '\tMismatches'
- print
if mark:
print '\tWill mark libraries with %s' % binary_flags
print
@@ -292,20 +278,24 @@ def run_soname(name, verbose, use_soname, mark, executable_only):
else:
print '\t%s ( %s )' % ( binary, binary_flags )
if library_flags != binary_flags:
- mismatched_binaries.append(binary)
- if not verbose:
- print '\t%s ( %s )' % ( binary, binary_flags )
+ if executable_only:
+ if os.path.dirname(binary) in shell_path:
+ mismatched_binaries.append(binary)
+ if not verbose:
+ print '\t%s ( %s )' % ( binary, binary_flags )
+ else:
+ mismatched_binaries.append(binary)
+ if not verbose:
+ print '\t%s ( %s )' % ( binary, binary_flags )
except:
print 'cannot obtain pax flags for %s' % binary
if len(mismatched_binaries) == 0:
- print
- print '\tNo mismatches'
+ if not verbose:
+ print '\tNo mismatches'
print
else:
print
- print '\tMismatches'
- print
if mark:
print '\tWill mark binaries with %s' % library_flags
print
@@ -344,7 +334,7 @@ def run_usage():
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 assuming verbose, only print out executables in shell $PATH'
+ print ' : -e only print out executables in shell $PATH'
print ' : -m don\'t just report, but mark the mismatching objects'
print
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2011-12-28 20:37 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2011-12-28 20:37 UTC (permalink / raw
To: gentoo-commits
commit: 68bea515fdb194cfecf57c3f51fda445bb62f7d0
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 20:37:52 2011 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 20:37:52 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=68bea515
scripts/revdep-pax: added an allyes option
---
doc/revdep-pax.1 | 16 ++++++++++------
doc/revdep-pax.pod | 16 ++++++++++------
scripts/revdep-pax | 44 +++++++++++++++++++++++++++-----------------
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2012-08-12 22:28 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2012-08-12 22:28 UTC (permalink / raw
To: gentoo-commits
commit: 5b3e110f489dac6cf1ee4122a143eb26f34d5ede
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 12 22:25:57 2012 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Aug 12 22:25:57 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=5b3e110f
Fixes a typo in revdep-pax script and documentation
Reported-by: Tully Gray <tullygray <AT> arc.net.au>
X-Gentoo-Bug: 431090
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=431090
---
doc/revdep-pax.1 | 6 +++---
doc/revdep-pax.pod | 2 +-
scripts/revdep-pax | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 698e90c..ee9ed5a 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -191,9 +191,9 @@ so that the PaX flags of the target inherit the flags of the source.
.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!)"
+.ie n .IP "\fB\-y\fR Assume ""yes"" to all prompts for masking (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.el .IP "\fB\-y\fR Assume ``yes'' to all prompts for masking (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.IX Item "-y Assume yes to all prompts for masking (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."
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index 19bf750..08034a4 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -72,7 +72,7 @@ so that the PaX flags of the target inherit the flags of the source.
=item
-=item B<-y> Assume "yes" to all prompts for making (USE CAREFULLY!)
+=item B<-y> Assume "yes" to all prompts for masking (USE CAREFULLY!)
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index b9fd83b..cd9770d 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -407,7 +407,7 @@ def run_usage():
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(' : -y assume "yes" to all prompts for masking (USE CAREFULLY!)')
print('\n'),
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] proj/elfix:master commit in: scripts/, doc/
@ 2012-08-12 23:34 Anthony G. Basile
0 siblings, 0 replies; 8+ messages in thread
From: Anthony G. Basile @ 2012-08-12 23:34 UTC (permalink / raw
To: gentoo-commits
commit: b58ea12526294b53d52887b8a8a4f39bf5b4dff5
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 12 22:25:57 2012 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Aug 12 23:33:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=b58ea125
Fixes a typo in revdep-pax script and documentation
Reported-by: Tully Gray <tullygray <AT> arc.net.au>
X-Gentoo-Bug: 431090
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=431090
---
doc/revdep-pax.1 | 6 +++---
doc/revdep-pax.pod | 2 +-
scripts/revdep-pax | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
index 698e90c..f801135 100644
--- a/doc/revdep-pax.1
+++ b/doc/revdep-pax.1
@@ -191,9 +191,9 @@ so that the PaX flags of the target inherit the flags of the source.
.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!)"
+.ie n .IP "\fB\-y\fR Assume ""yes"" to all prompts for marking (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.el .IP "\fB\-y\fR Assume ``yes'' to all prompts for marking (\s-1USE\s0 \s-1CAREFULLY\s0!)" 4
+.IX Item "-y Assume yes to all prompts for marking (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."
diff --git a/doc/revdep-pax.pod b/doc/revdep-pax.pod
index 19bf750..7cddd9d 100644
--- a/doc/revdep-pax.pod
+++ b/doc/revdep-pax.pod
@@ -72,7 +72,7 @@ so that the PaX flags of the target inherit the flags of the source.
=item
-=item B<-y> Assume "yes" to all prompts for making (USE CAREFULLY!)
+=item B<-y> Assume "yes" to all prompts for marking (USE CAREFULLY!)
=item
diff --git a/scripts/revdep-pax b/scripts/revdep-pax
index b9fd83b..9a990a2 100755
--- a/scripts/revdep-pax
+++ b/scripts/revdep-pax
@@ -407,7 +407,7 @@ def run_usage():
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(' : -y assume "yes" to all prompts for marking (USE CAREFULLY!)')
print('\n'),
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-08-12 23:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-26 18:51 [gentoo-commits] proj/elfix:master commit in: scripts/, doc/ Anthony G. Basile
-- strict thread matches above, loose matches on Subject: below --
2012-08-12 23:34 Anthony G. Basile
2012-08-12 22:28 Anthony G. Basile
2011-12-28 20:37 Anthony G. Basile
2011-11-29 4:19 Anthony G. Basile
2011-11-26 19:08 Anthony G. Basile
2011-11-26 19:08 Anthony G. Basile
2011-11-26 18:43 Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox