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 B3937138825 for ; Tue, 11 Nov 2014 16:36:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7E4E7E0BE8; Tue, 11 Nov 2014 16:36:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 088CDE0BE8 for ; Tue, 11 Nov 2014 16:36:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 754F03402BF for ; Tue, 11 Nov 2014 16:36:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1BF269ED1 for ; Tue, 11 Nov 2014 16:36:08 +0000 (UTC) From: "Paul Varner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paul Varner" Message-ID: <1415723493.14f2062ff0ce73d0118f960bad8e15425b73e538.fuzzyray@gentoo> Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: man/, bin/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: bin/revdep-rebuild.sh man/revdep-rebuild.1 X-VCS-Directories: bin/ man/ X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner X-VCS-Revision: 14f2062ff0ce73d0118f960bad8e15425b73e538 X-VCS-Branch: gentoolkit Date: Tue, 11 Nov 2014 16:36:08 +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: 2c3be10d-e14e-47a5-8cdd-a7504cf31260 X-Archives-Hash: b17edc6662e37043d278bb9991bd5a31 commit: 14f2062ff0ce73d0118f960bad8e15425b73e538 Author: Paul Varner gentoo org> AuthorDate: Tue Nov 11 16:31:33 2014 +0000 Commit: Paul Varner gentoo org> CommitDate: Tue Nov 11 16:31:33 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=14f2062f revdep-rebuild.sh: Look for issues with symbols. (Bug 63643) These changes cause revdep-rebuild.sh to unconditionally look for "Symbol not defined" in ldd -d -r ouput. Additionally, it adds the options -u, --search-symbols to look for "undefined symbol". Using this option will cause false positives in the revdep-rebuild output. --- bin/revdep-rebuild.sh | 38 ++++++++++++++++++++++++++++++++++++-- man/revdep-rebuild.1 | 3 +++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh index 01a0454..633701e 100755 --- a/bin/revdep-rebuild.sh +++ b/bin/revdep-rebuild.sh @@ -54,6 +54,7 @@ declare ORDER_PKGS # ...sort the atoms in deep dependency order declare PACKAGE_NAMES # ...emerge by slot, not by versionated atom declare RM_OLD_TEMPFILES # ...remove tempfiles from prior runs declare SEARCH_BROKEN # ...search for broken libraries and binaries +declare SEARCH_SYMBOLS # ...search for broken binaries with undefined symbols declare VERBOSE # ...give verbose output # Globals that impact portage directly: @@ -191,6 +192,7 @@ Broken reverse dependency rebuilder. (also passed to emerge command) -P, --no-progress Turn off the progress meter -q, --quiet Be less verbose (also passed to emerge command) + -u, --search-symbols Search for undefined symbols (may have false positives) -v, --verbose Be more verbose (also passed to emerge command) Calls emerge, options after -- are ignored by $APP_NAME @@ -390,6 +392,7 @@ get_longopts() { --quiet) progress() { :; } QUIET=1 EMERGE_OPTIONS+=($1);; + --search-symbols) SEARCH_SYMBOLS=1;; --verbose) VERBOSE=1 EMERGE_OPTIONS+=("--verbose");; --extra-verbose) warn_deprecated_opt "$1" "--verbose" @@ -408,7 +411,7 @@ get_longopts() { # Get single-letter commandline options preceded by a single dash. get_shortopts() { local OPT OPTSTRING OPTARG OPTIND - while getopts ":CdehikL:loPpqu:vX" OPT; do + while getopts ":CdehikL:loPpquvX" OPT; do case "$OPT" in C) # TODO: Match syntax with the rest of gentoolkit export NOCOLOR="yes";; @@ -429,6 +432,7 @@ get_shortopts() { q) progress() { :; } QUIET=1 EMERGE_OPTIONS+=("--quiet");; + u) SEARCH_SYMBOLS=1;; v) VERBOSE=1 EMERGE_OPTIONS+=("--verbose");; X) # No longer used, since it is the default. @@ -732,6 +736,8 @@ main_checks() { local ldd_status local numFiles local COMPLETE_LD_LIBRARY_PATH + local message + local broken_lib if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]] || die 1 "Unable to find $LDPATH_FILE" @@ -748,7 +754,7 @@ main_checks() { if [[ $target_file != *.la ]]; then # Note: double checking seems to be faster than single with complete path # (special add ons are rare). - ldd_output=$(ldd "$target_file" 2>> "$ERRORS_FILE" | sort -u) + ldd_output=$(ldd -d -r "$target_file" 2>> "$ERRORS_FILE" | sort -u) ldd_status=$? # TODO: Check this for problems with sort # HACK: if LD_LIBRARY_MASK is null or undefined grep -vF doesn't work if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" | @@ -794,6 +800,34 @@ main_checks() { fi fi fi + # Search for symbols not defined + if [[ $SEARCH_BROKEN ]]; then + # Look for symbol not defined errors + if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" | + grep -q -E 'symbol .* not defined'; then + message=$(gawk '/symbol .* not defined/ {NF--; print $0}' <<< "$ldd_output") + broken_lib=$(gawk '/symbol .* not defined/ {print $NF}' <<< "$ldd_output" | \ + sed 's/[()]//g') + echo "obj $broken_lib" >> "$BROKEN_FILE" + echo_v " broken $broken_lib ($message)" + fi + fi + # Look for undefined symbol error if not a .so file + if [[ $SEARCH_BROKEN && $SEARCH_SYMBOLS ]]; then + case $target_file in + *.so|*.so.*) + ;; + *) + if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" | + grep -q -F 'undefined symbol:'; then + message=$(gawk '/undefined symbol:/ {print $3}' <<< "$ldd_output") + message="${message//$'\n'/ }" + echo "obj $target_file" >> "$BROKEN_FILE" + echo_v " broken $target_file (undefined symbols(s): $message)" + fi + ;; + esac + fi elif [[ $SEARCH_BROKEN ]]; then # Look for broken .la files la_SEARCH_DIRS="$(parse_ld_so_conf)" diff --git a/man/revdep-rebuild.1 b/man/revdep-rebuild.1 index 59d7def..d1833e1 100644 --- a/man/revdep-rebuild.1 +++ b/man/revdep-rebuild.1 @@ -44,6 +44,9 @@ Turn off the progress meter .B \-q | \-\-quiet Print less output and disable the progress meter. (This option is also passed to portage.) .TP +.B \-u | \-\-search\-symbols +Searches for undefined symbols in executibles. This will most likely have false positives in the output, so it is recommended to only use this option with pretend and manually fix any legitimate issues found. \fBNote:\fR This is currently only implemented in revdep-rebuild.sh, it is not implemented in revdep-rebuild.py. +.TP .B \-v | \-\-verbose More output. (Prints the revdep\-rebuild search environment.) .TP