From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9EDCE1381F3 for ; Sun, 23 Dec 2012 03:49:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A355E05D9; Sun, 23 Dec 2012 03:49:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 81A5DE05D9 for ; Sun, 23 Dec 2012 03:49:37 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 439E233DACB for ; Sun, 23 Dec 2012 03:49:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 8ED18E544C for ; Sun, 23 Dec 2012 03:49:33 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1356234550.e7efaf0473dfeacdaa8404ca6a7b70dc441c1485.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: misc/ X-VCS-Repository: proj/elfix X-VCS-Files: misc/alt-revdep-pax X-VCS-Directories: misc/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: e7efaf0473dfeacdaa8404ca6a7b70dc441c1485 X-VCS-Branch: master Date: Sun, 23 Dec 2012 03:49:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d4d546b2-57a9-45d0-adae-e50259c9a15a X-Archives-Hash: 870813dc1b087c2c67743370a4642a69 commit: e7efaf0473dfeacdaa8404ca6a7b70dc441c1485 Author: Anthony G. Basile gentoo org> AuthorDate: Sun Dec 23 03:47:31 2012 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sun Dec 23 03:49:10 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=e7efaf04 misc/alt-revdep-pax: add print forward linkings per elf object (-b) --- misc/alt-revdep-pax | 52 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 31 insertions(+), 21 deletions(-) diff --git a/misc/alt-revdep-pax b/misc/alt-revdep-pax index 6fb88fa..4ea90d4 100755 --- a/misc/alt-revdep-pax +++ b/misc/alt-revdep-pax @@ -365,28 +365,35 @@ def migrate_flags(importer, exporter_str_flags, exporter_bin_flags): pax.setbinflags(importer, result_bin_flags) -def run_binary(binary, verbose, mark, allyes): - if not os.path.exists(binary): - print('%s\tNo such OBJECT' % binary) +def run_elf(elf, verbose, mark, allyes): + + if not os.path.exists(elf): + print('%s\tNo such OBJECT' % elf) return - ( linkings, mappings ) = get_ldd_linkings(binary) - ( binary_str_flags, binary_bin_flags ) = pax.getflags(binary) - print('%s (%s)\n' % ( binary, binary_str_flags )) + + try: + (elf_str_flags, elf_bin_flags) = pax.getflags(elf) + print('%s (%s)\n' % (elf, elf_str_flags)) + except pax.PaxError: + print('%s: No PAX flags found\n' % elf) + return + + (object_linkings, soname2library) = get_object_linkings() mismatched_libraries = [] - for soname in linkings: + for soname in object_linkings[elf]: try: - library = mappings[soname] + library = soname2library[soname] ( library_str_flags, library_bin_flags ) = pax.getflags(library) if verbose: print('\t%s\t%s ( %s )' % ( soname, library, library_str_flags )) - if binary_str_flags != library_str_flags: + if elf_str_flags != library_str_flags: mismatched_libraries.append(library) if not verbose: print('\t%s\t%s ( %s )' % ( soname, library, library_str_flags )) except pax.PaxError: - print('file for soname %s not found' % soname) + print('%s: file for soname not found' % soname) if len(mismatched_libraries) == 0: if not verbose: @@ -394,7 +401,7 @@ def run_binary(binary, verbose, mark, allyes): else: print('\n'), if mark: - print('\tWill mark libraries with %s\n' % binary_str_flags) + print('\tWill mark libraries with %s\n' % elf_str_flags) for library in mismatched_libraries: do_marking = False while True: @@ -413,12 +420,15 @@ def run_binary(binary, verbose, mark, allyes): if do_marking: try: - migrate_flags(library, binary_str_flags, binary_bin_flags) + migrate_flags(library, elf_str_flags, elf_bin_flags) + except pax.PaxError: + print('\n\tCould not set PAX flags on %s, text maybe busy' % library) + + try: + ( library_str_flags, library_bin_flags ) = pax.getflags(library) + print('\n\t\t%s ( %s )\n' % ( library, library_str_flags )) except pax.PaxError: - print("\n\tCould not set pax flags on %s, file is probably busy" % library) - print("\tShut down all processes that use it and try again") - ( library_str_flags, library_bin_flags ) = pax.getflags(library) - print('\n\t\t%s ( %s )\n' % ( library, library_str_flags )) + print('\n\t\t%s: Could not read PAX flags') def invert_so2library_mappings( so2library_mappings ): @@ -555,8 +565,8 @@ def main(): do_forward = False do_reverse = False - binary = None - soname = None + elf = None + soname = None library = None verbose = False @@ -577,7 +587,7 @@ def main(): do_reverse = True opt_count += 1 elif o == '-b': - binary = a + elf = a opt_count += 1 elif o == '-s': soname = a @@ -605,8 +615,8 @@ def main(): run_forward(verbose) elif do_reverse: run_reverse(verbose, executable_only) - elif binary != None: - run_binary(binary, verbose, mark, allyes) + elif elf != None: + run_elf(elf, verbose, mark, allyes) elif soname != None: run_soname(soname, verbose, True, mark, allyes, executable_only) elif library != None: