[csw-devel] SF.net SVN: gar:[21714] csw/mgar/gar/v2/bin/check_db_symbols

chninkel at users.sourceforge.net chninkel at users.sourceforge.net
Mon Aug 12 23:27:09 CEST 2013


Revision: 21714
          http://gar.svn.sourceforge.net/gar/?rev=21714&view=rev
Author:   chninkel
Date:     2013-08-12 21:27:07 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
gar/v2: check_db_symbols: handle the case where a library is not found

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/check_db_symbols

Modified: csw/mgar/gar/v2/bin/check_db_symbols
===================================================================
--- csw/mgar/gar/v2/bin/check_db_symbols	2013-08-12 14:56:45 UTC (rev 21713)
+++ csw/mgar/gar/v2/bin/check_db_symbols	2013-08-12 21:27:07 UTC (rev 21714)
@@ -19,6 +19,7 @@
     my ($binary) = @_;
     my %symbol_flags_of;
 
+    local $ENV{'LANG'} = 'C';
     open( my $elfdump, '-|', "$ELFDUMP_BIN -y $binary" ) or die "ERROR: Can't analyze $binary with elfdump !";
     while (my $line = <$elfdump>) {
         chomp($line);
@@ -50,6 +51,7 @@
     my ($binary) = @_;
     my %library_location;
 
+    local $ENV{'LANG'} = 'C';
     open( my $ldd, '-|', "$LDD_BIN $binary" ) or die "ERROR: Can't analyze $binary with elfdump !";
     while (my $line = <$ldd>) {
         my ( $soname, $library_path ) = (
@@ -58,6 +60,10 @@
                              (\S+)      # library path
                          }x
         );
+	# (file not found) case
+	if ($library_path eq '(file') {
+		$library_path = undef;
+	}
         $library_location{$soname} = $library_path;
     }
     close($ldd);
@@ -103,6 +109,7 @@
     )
 );
 
+my @unfound_libraries;
 foreach my $soname ( keys( %{$symbol_flags_of} ) ) {
     next if ( $soname eq '<self>' );
 
@@ -112,8 +119,12 @@
         non_directly_bindable => 0,
     );
 
-    my $soname_symbol_flags_for =
-      get_symbols_flags( $library_location_of->{$soname} );
+    my $library_location = $library_location_of->{$soname};
+    if (not defined($library_location)) {
+	push (@unfound_libraries, $soname);
+	next;
+    }
+    my $soname_symbol_flags_for = get_symbols_flags( $library_location );
 
     foreach my $symbol ( keys( %{ $symbol_flags_of->{$soname} } ) ) {
         my $flag = $symbol_flags_of->{$soname}{$symbol};
@@ -141,5 +152,14 @@
     );
 }
 
+if (@unfound_libraries) {
+   print <<'EOF';
+
+The following libraries were not found, please make sure
+I can find them next time by setting LD_LIBRARY_PATH adequately:
+EOF
+   print ("\t" . join(', ', @unfound_libraries) . "\n");
+}
+
 print "\n";
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list