The branch, dpkg-shlibdeps-buxy has been updated
via fddb619b2d5d92bb7b735688ac78e260583b75a4 (commit)
via 1c2c6ce514c967348ebae88e5afc5ed3ff9da183 (commit)
via fb437163ca96a0df0e98e50852412e42030add54 (commit)
from 90dfbd7eb305b880935f8b6cb57bf81fa753e283 (commit)
- Log -----------------------------------------------------------------
commit fddb619b2d5d92bb7b735688ac78e260583b75a4
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Tue Aug 14 15:22:23 2007 +0200
Deperecate a symbol only when the history of version matches.
When merging symbols in a SymbolFile, a symbol is deprecated when it has
disappeared from the new set of symbols. However when the new set of
symbols dates back to before the current one, deprecating doesn't make
sense. This patch corrects this behaviour. Also add a test to verify that
symbols got correctly marked as deprecated.
commit 1c2c6ce514c967348ebae88e5afc5ed3ff9da183
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Tue Aug 14 15:09:58 2007 +0200
Don't consider local symbols when merging symbols in SymbolFile
Local symbols can only be used by the object defining them so they
can't be used by applications linked against the library. Hence they
are not needed in the "symbols" files that we used to track dependencies
on shared libraries. Use the get_exported_dynamic_symbols function to
ensure that we use the right set of symbols.
commit fb437163ca96a0df0e98e50852412e42030add54
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Tue Aug 14 14:38:16 2007 +0200
Add new attributes (local, global, visibility) to Dpkg::Shlibs::Objdump's
symbols
Those new attributes are needed for further changes in dpkg-gensymbols
behaviour. Update the test suite to include the new attributes.
-----------------------------------------------------------------------
Summary of changes:
scripts/Dpkg/Shlibs/Objdump.pm | 19 ++++++++++++++-----
scripts/Dpkg/Shlibs/SymbolFile.pm | 29 +++++++++++++++++++----------
scripts/t/200_Dpkg_Shlibs.t | 9 ++++++++-
3 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm
index cd51f42..307e63b 100644
--- a/scripts/Dpkg/Shlibs/Objdump.pm
+++ b/scripts/Dpkg/Shlibs/Objdump.pm
@@ -224,14 +224,20 @@ sub _parse {
sub parse_dynamic_symbol {
my ($self, $line) = @_;
- my $vis = '(?:\.protected|\.hidden|\.internal|0x\S+)';
- if ($line =~ /^[0-9a-f]+
(.{7})\s+(\S+)\s+[0-9a-f]+\s+(\S+)?(?:(?:\s+$vis)?\s+(\S+))/) {
+ my $vis_re = '(\.protected|\.hidden|\.internal|0x\S+)';
+ if ($line =~ /^[0-9a-f]+
(.{7})\s+(\S+)\s+[0-9a-f]+\s+(\S+)?(?:(?:\s+$vis_re)?\s+(\S+))/) {
- my ($flags, $sect, $ver, $name) = ($1, $2, $3, $4);
+ my ($flags, $sect, $ver, $vis, $name) = ($1, $2, $3, $4, $5);
# Special case if version is missing but extra visibility
# attribute replaces it in the match
- $ver = '' if defined($ver) and $ver =~ /^$vis$/;
+ if (defined($ver) and $ver =~ /^$vis_re$/) {
+ $vis = $ver;
+ $ver = '';
+ }
+
+ # Cleanup visibility field
+ $vis =~ s/^\.// if defined($vis);
my $symbol = {
name => $name,
@@ -241,6 +247,9 @@ sub parse_dynamic_symbol {
debug => substr($flags, 5, 1) eq "d",
type => substr($flags, 6, 1),
weak => substr($flags, 1, 1) eq "w",
+ local => substr($flags, 0, 1) eq "l",
+ global => substr($flags, 0, 1) eq "g",
+ visibility => defined($vis) ? $vis : '',
hidden => '',
defined => $sect ne '*UND*'
};
@@ -287,7 +296,7 @@ sub get_symbol {
sub get_exported_dynamic_symbols {
my ($self) = @_;
- return grep { $_->{defined} && $_->{dynamic} }
+ return grep { $_->{defined} && $_->{dynamic} && !$_->{local} }
values %{$self->{dynsyms}};
}
diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm
b/scripts/Dpkg/Shlibs/SymbolFile.pm
index f8a0942..051e7eb 100644
--- a/scripts/Dpkg/Shlibs/SymbolFile.pm
+++ b/scripts/Dpkg/Shlibs/SymbolFile.pm
@@ -122,7 +122,7 @@ sub load {
};
$self->{objects}{$object}{syms}{$2} = $sym;
} elsif (/^#/) {
- #Â Skip possible comments
+ # Skip possible comments
} elsif (/^\|\s*(.*)$/) {
# Alternative dependency template
push @{$self->{objects}{$object}{deps}}, "$1";
@@ -182,12 +182,15 @@ sub dump {
sub merge_symbols {
my ($self, $object, $minver) = @_;
my $soname = $object->{SONAME} || error(_g("Can't merge symbols from
objects without SONAME."));
- my %dynsyms = map { $_ => $object->{dynsyms}{$_} }
- grep {
- local $a = $object->{dynsyms}{$_};
- $a->{dynamic} && $a->{defined} && not exists $blacklist{$a->{name}}
+ my %dynsyms;
+ foreach my $sym ($object->get_exported_dynamic_symbols()) {
+ next if exists $blacklist{$sym->{name}};
+ if ($sym->{version}) {
+ $dynsyms{$sym->{name} . '@' . $sym->{version}} = $sym;
+ } else {
+ $dynsyms{$sym->{name}} = $sym;
}
- keys %{$object->{dynsyms}};
+ }
unless ($self->{objects}{$soname}) {
$self->create_object($soname, '');
@@ -220,10 +223,14 @@ sub merge_symbols {
}
# Scan all symbols in the file and mark as deprecated those that are
- # no more provided
+ # no more provided (only if the minver is bigger than the version where
+ # the symbol was introduced)
foreach my $sym (keys %{$self->{objects}{$soname}{syms}}) {
if (! exists $dynsyms{$sym}) {
- $self->{objects}{$soname}{syms}{$sym}{deprecated} = $minver;
+ my $info = $self->{objects}{$soname}{syms}{$sym};
+ if (vercmp($minver, $info->{minver}) > 0) {
+ $self->{objects}{$soname}{syms}{$sym}{deprecated} = $minver;
+ }
}
}
}
@@ -253,11 +260,13 @@ sub get_dependency {
}
sub lookup_symbol {
- my ($self, $name, $sonames) = @_;
+ my ($self, $name, $sonames, $inc_deprecated) = @_;
+ $inc_deprecated = 0 unless defined($inc_deprecated);
foreach my $so (@{$sonames}) {
next if (! exists $self->{objects}{$so});
if (exists $self->{objects}{$so}{syms}{$name} and
- not $self->{objects}{$so}{syms}{$name}{deprecated})
+ ($inc_deprecated or not
+ $self->{objects}{$so}{syms}{$name}{deprecated}))
{
my $dep_id = $self->{objects}{$so}{syms}{$name}{dep_id};
return {
diff --git a/scripts/t/200_Dpkg_Shlibs.t b/scripts/t/200_Dpkg_Shlibs.t
index f19f83d..b2e3fef 100644
--- a/scripts/t/200_Dpkg_Shlibs.t
+++ b/scripts/t/200_Dpkg_Shlibs.t
@@ -1,6 +1,6 @@
# -*- mode: cperl;-*-
-use Test::More tests => 25;
+use Test::More tests => 26;
use strict;
use warnings;
@@ -37,11 +37,13 @@ my $sym = $obj->get_symbol('[EMAIL PROTECTED]');
is_deeply( $sym, { name => '_sys_nerr', version => 'GLIBC_2.3',
soname => 'libc.so.6', section => '.rodata', dynamic => 1,
debug => '', type => 'O', weak => '',
+ local => '', global => 1, visibility => '',
hidden => 1, defined => 1 }, 'Symbol' );
$sym = $obj->get_symbol('_IO_stdin_used');
is_deeply( $sym, { name => '_IO_stdin_used', version => '',
soname => 'libc.so.6', section => '*UND*', dynamic => 1,
debug => '', type => ' ', weak => 1,
+ local => '', global => '', visibility => '',
hidden => '', defined => '' }, 'Symbol 2' );
my @syms = $obj->get_exported_dynamic_symbols;
@@ -77,6 +79,10 @@ ok( $sym_file_old->has_lost_symbols($sym_file), 'has lost
symbols' );
is( $sym_file_old->lookup_symbol('[EMAIL PROTECTED]', ['libc.so.6']),
undef, 'internal symbols are blacklisted');
+$sym = $sym_file->lookup_symbol('[EMAIL PROTECTED]', ['libc.so.6'], 1);
+is_deeply($sym, { 'minver' => '2.3.6.ds1-13', 'dep_id' => 0,
+ 'deprecated' => '2.6-1', 'depends' => '',
+ 'soname' => 'libc.so.6' }, 'deprecated symbol');
use File::Temp;
@@ -132,6 +138,7 @@ $sym = $obj->get_symbol('IA__g_free');
is_deeply( $sym, { name => 'IA__g_free', version => '',
soname => 'libglib-2.0.so.0', section => '.text', dynamic =>
1,
debug => '', type => 'F', weak => '',
+ local => 1, global => '', visibility => 'hidden',
hidden => '', defined => 1 },
'symbol with visibility without version' );
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]