summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/Dpkg/Shlibs/Symbol.pm26
-rw-r--r--scripts/t/200_Dpkg_Shlibs.t14
-rw-r--r--scripts/t/200_Dpkg_Shlibs/patterns.symbols2
3 files changed, 23 insertions, 19 deletions
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index 5ae47b86d..2964f1d8f 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -157,23 +157,22 @@ sub initialize {
$type = 'alias-c++';
}
+ # Support old style wildcard syntax. That's basically a symver
+ # with an optional tag.
+ if ($self->get_symbolname() =~ /^\*@(.*)$/) {
+ $self->add_tag("symver") unless $self->has_tag("symver");
+ $self->add_tag("optional") unless $self->has_tag("optional");
+ $self->{symbol} = $1;
+ }
+
if ($self->has_tag('symver')) {
# Each symbol is matched against its version rather than full
# name@version string.
$type = (defined $type) ? 'generic' : 'alias-symver';
- }
- # Support old style wildcard syntax as well. That's basically a symver
- # with implicit optional tag.
- if ($self->get_symbolname() =~ /^\*@(.*)$/) {
- error(_g("you can't use wildcards on unversioned symbols: %s"), $_) if $1 eq "Base";
- # symver pattern needs symbol name to be its version. However, keeping
- # dumping this as old style wildcard in the output.
- unless (defined $self->{symbol_templ}) {
- $self->{symbol_templ} = $self->get_symbolname();
+ if ($self->get_symbolname() eq "Base") {
+ error(_g("you can't use symver tag to catch unversioned symbols: %s"),
+ $self->get_symbolspec(1));
}
- $type = (defined $type) ? 'generic' : 'alias-symver';
- $self->{symbol} = $1;
- $self->{pattern}{old_wildcard} = 1;
}
# As soon as regex is involved, we need to match each real
@@ -270,8 +269,7 @@ sub equals {
sub is_optional {
my $self = shift;
- return $self->has_tag("optional") ||
- (exists $self->{pattern} && exists $self->{pattern}{old_wildcard});
+ return $self->has_tag("optional");
}
sub is_arch_specific {
diff --git a/scripts/t/200_Dpkg_Shlibs.t b/scripts/t/200_Dpkg_Shlibs.t
index 6898ef636..302a2c8c9 100644
--- a/scripts/t/200_Dpkg_Shlibs.t
+++ b/scripts/t/200_Dpkg_Shlibs.t
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-use Test::More tests => 104;
+use Test::More tests => 106;
use Cwd;
use IO::String;
@@ -152,6 +152,7 @@ $sym = $sym_file_old->lookup_symbol('__nss_services_lookup@GLIBC_PRIVATE', ['lib
is_deeply($sym, Dpkg::Shlibs::Symbol->new( 'symbol' => '__nss_services_lookup@GLIBC_PRIVATE',
'minver' => '2.3.6.wildcard', 'dep_id' => 0,
'deprecated' => 0, 'depends' => '',
+ 'tags' => { 'symver' => undef, optional => undef }, 'tagorder' => [ 'symver', 'optional' ],
'soname' => 'libc.so.6', 'matching_pattern' => $pat ), 'wildcarded symbol');
# Save -> Load test
@@ -457,9 +458,14 @@ ok ( $sym->get_pattern()->equals($sym_file->create_symbol('(c++|symver)SYMVER_1
# Test old style wildcard support
load_patterns_symbols();
-$pat = $sym_file->lookup_pattern($sym_file->create_symbol('*@SYMVEROPT_2 2'), ['libpatterns.so.1']);
-ok ( $pat->is_optional(), "Old style wildcard is optional");
-is ( $pat->get_alias_type(), "symver", "old style wildcard is a symver pattern" );
+$sym = $sym_file->create_symbol('*@SYMVEROPT_2 2');
+ok ( $sym->is_optional(), "Old style wildcard is optional");
+is ( $sym->get_alias_type(), "symver", "old style wildcard is a symver pattern" );
+is ( $sym->get_symbolname(), 'SYMVEROPT_2', "wildcard pattern got renamed" );
+
+$pat = $sym_file->lookup_pattern($sym_file->create_symbol('(symver|optional)SYMVEROPT_2 2'), ['libpatterns.so.1']);
+$sym->{symbol_templ} = $pat->{symbol_templ};
+is_deeply( $pat, $sym, "old style wildcard is the same as (symver|optional)" );
# Get rid of all SymverOptional symbols
foreach my $tmp (keys %{$obj->{dynsyms}}) {
diff --git a/scripts/t/200_Dpkg_Shlibs/patterns.symbols b/scripts/t/200_Dpkg_Shlibs/patterns.symbols
index f626eaeab..bacf799d9 100644
--- a/scripts/t/200_Dpkg_Shlibs/patterns.symbols
+++ b/scripts/t/200_Dpkg_Shlibs/patterns.symbols
@@ -1,7 +1,7 @@
libpatterns.so.1 libpatterns1 #MINVER#
- *@SYMVEROPT_2 2
(c++|regex|optional)NSA::ClassA::Private(::.*)?@Base 1.private
(c++)NSB::Symver::symver_method2()@SYMVER_1 1.method2
+ (symver|optional)SYMVEROPT_2 2
SYMVEROPT_2@SYMVEROPT_2 2
(c++|symver)SYMVER_1 1.generic
SYMVER_1@SYMVER_1 1