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 A81B01381F3 for ; Sat, 15 Dec 2012 20:03:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6091221C041; Sat, 15 Dec 2012 20:03:43 +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 C925C21C041 for ; Sat, 15 Dec 2012 20:03:42 +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 B428733DC8C for ; Sat, 15 Dec 2012 20:03:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 4FA62E543C for ; Sat, 15 Dec 2012 20:03:40 +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: <1355601803.b7ba4e91d13b546a6b5fb6e44b9d3ac465fb9141.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:master commit in: scripts/ X-VCS-Repository: proj/elfix X-VCS-Files: scripts/revdep-pax X-VCS-Directories: scripts/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: b7ba4e91d13b546a6b5fb6e44b9d3ac465fb9141 X-VCS-Branch: master Date: Sat, 15 Dec 2012 20:03:40 +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: 45157e7b-2cea-42a4-98d7-339ee3ec2adf X-Archives-Hash: 51a70c8057f62628632300827a6a58bd commit: b7ba4e91d13b546a6b5fb6e44b9d3ac465fb9141 Author: Anthony G. Basile gentoo org> AuthorDate: Sat Dec 15 20:03:23 2012 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sat Dec 15 20:03:23 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=b7ba4e91 scripts/revdep-pax: clean up flag exporter/importer logic --- scripts/revdep-pax | 51 ++++++++++++++++++++++----------------------------- 1 files changed, 22 insertions(+), 29 deletions(-) diff --git a/scripts/revdep-pax b/scripts/revdep-pax index 9a990a2..8626e95 100755 --- a/scripts/revdep-pax +++ b/scripts/revdep-pax @@ -189,27 +189,19 @@ def run_reverse(verbose, executable_only): def migrate_flags(importer, exporter_str_flags, exporter_bin_flags): # We implement the following logic for setting the pax flags - # on the target elf object, the 'importer', given that the - # flags from the elf object we want it to match to, the exporter. + # on the target elf object, the IMPORTER, given that the flags + # from the elf object we want it to match to, the EXPORTER. # - # Importer Exporter Result - # Force On Force On Force On - # Force On Force Off Force On + Warn - # Force On Nothing Force On - # Force Off Force On Force Off + Warn - # Force Off Force Off Force Off - # Force Off Nothing Force Off - # Nothing Force On Force On - # Nothing Force Off Force Off - # Nothing Nothing Nothing - # - # The algorithm proceeds by assuming the resulting flags = the exporter - # flags and then changes them in cases where that's not what we want, ie - # - # Force On Force Off Force On + Warn - # Force On Nothing Force On - # Force Off Force On Force Off + Warn - # Force Off Nothing Force Off + # EXPORTER IMPORTER RESULT + # On On On + # On Off On + Warn + # On - On + # Off On On + Warn + # Off Off Off + # Off - Off + # - On On + # - Off Off + # - - - #See /usr/include/elf.h for these values pf_flags = { @@ -223,22 +215,23 @@ def migrate_flags(importer, exporter_str_flags, exporter_bin_flags): ( importer_str_flags, importer_bin_flags ) = pax.getflags(importer) + # Start with the exporter's flags result_bin_flags = exporter_bin_flags for i in range(len(importer_str_flags)): - if importer_str_flags[i].isupper() and exporter_str_flags[i].islower(): - result_bin_flags = result_bin_flags ^ pf_flags[exporter_str_flags[i]] - result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] - print('\t\tWarning: %s has %s, refusing to set to %s' % ( - importer, importer_str_flags[i], exporter_str_flags[i] )), - if importer_str_flags[i].isupper() and exporter_str_flags[i] == '-': - result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] - if importer_str_flags[i].islower() and exporter_str_flags[i].isupper(): + + # The exporter's flag contradicts the importer's flag, so do nothing + if (exporter_str_flags[i].isupper() and importer_str_flags[i].islower()) or \ + (exporter_str_flags[i].islower() and importer_str_flags[i].isupper()): + + # Revert the exporter's flag, use the importer's flag and warn result_bin_flags = result_bin_flags ^ pf_flags[exporter_str_flags[i]] result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] print('\t\tWarning: %s has %s, refusing to set to %s' % ( importer, importer_str_flags[i], exporter_str_flags[i] )), - if importer_str_flags[i].islower() and exporter_str_flags[i] == '-': + + # The exporter's flags is off, so use the importer's flag + if (exporter_str_flags[i] == '-' and importer_str_flags[i] != '-'): result_bin_flags = result_bin_flags | pf_flags[importer_str_flags[i]] pax.setbinflags(importer, result_bin_flags)