This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=4e36bcb7bcfedc21068320cfbc649eb9095b0677 commit 4e36bcb7bcfedc21068320cfbc649eb9095b0677 Author: Guillem Jover <guil...@debian.org> AuthorDate: Mon Aug 25 01:10:45 2025 +0200 perl: Fix indentation Fix wrong indentation levels in code. Most of the code produces no diff with the -w option, except for the code that required wrapping to avoid going over the 80 character limit. Blame-Ignore: yes --- lib/dpkg/t/t-treewalk.t | 2 +- scripts/Dpkg/Changelog/Debian.pm | 88 +++++++------- scripts/Dpkg/Changelog/Entry/Debian.pm | 36 +++--- scripts/Dpkg/Deps/Simple.pm | 26 ++--- scripts/Dpkg/Source/Package.pm | 8 +- scripts/Dpkg/Source/Package/V1.pm | 8 +- scripts/Dpkg/Source/Package/V3/Git.pm | 17 ++- scripts/Dpkg/Vendor/Debian.pm | 6 +- scripts/Dpkg/Vendor/PureOS.pm | 15 ++- scripts/Dpkg/Vendor/Ubuntu.pm | 41 ++++--- scripts/dpkg-architecture.pl | 4 +- scripts/dpkg-scanpackages.pl | 4 +- scripts/dpkg-shlibdeps.pl | 204 +++++++++++++++++---------------- scripts/t/Dpkg_Arch.t | 8 +- scripts/t/Dpkg_BuildFlags_Ubuntu.t | 2 +- scripts/t/Dpkg_BuildInfo.t | 2 +- scripts/t/Dpkg_BuildTypes.t | 6 +- scripts/t/Dpkg_Changelog.t | 65 ++++++----- scripts/t/Dpkg_Checksums.t | 2 +- scripts/t/Dpkg_Control_Fields.t | 4 +- scripts/t/Dpkg_Deps.t | 22 ++-- scripts/t/Dpkg_Source_Archive.t | 8 +- scripts/t/Dpkg_Source_Package.t | 4 +- scripts/t/Dpkg_Source_Patch.t | 2 +- scripts/t/Dpkg_Substvars.t | 84 +++++++------- scripts/t/Dpkg_Version.t | 34 +++--- 26 files changed, 358 insertions(+), 344 deletions(-) diff --git a/lib/dpkg/t/t-treewalk.t b/lib/dpkg/t/t-treewalk.t index be9acb51d..2a29e2fca 100755 --- a/lib/dpkg/t/t-treewalk.t +++ b/lib/dpkg/t/t-treewalk.t @@ -119,7 +119,7 @@ sub test_treewalker { return if $type eq 'skip' and m{^\Q$dirtree\E/cccc}; push @paths, s{\./}{}r; }, - }, $dirtree); + }, $dirtree); my $expected; diff --git a/scripts/Dpkg/Changelog/Debian.pm b/scripts/Dpkg/Changelog/Debian.pm index 82444ac98..a9a1b3d33 100644 --- a/scripts/Dpkg/Changelog/Debian.pm +++ b/scripts/Dpkg/Changelog/Debian.pm @@ -63,57 +63,57 @@ use constant { my $ancient_delimiter_regex = qr{ ^ (?: # Ancient GNU style changelog entry with expanded date - (?: - \w+\s+ # Day of week (abbreviated) - \w+\s+ # Month name (abbreviated) - \d{1,2} # Day of month - \Q \E - \d{1,2}:\d{1,2}:\d{1,2}\s+ # Time - [\w\s]* # Timezone - \d{4} # Year - ) - \s+ - (?:.*) # Maintainer name - \s+ - [<\(] - (?:.*) # Maintainer email - [\)>] + (?: + \w+\s+ # Day of week (abbreviated) + \w+\s+ # Month name (abbreviated) + \d{1,2} # Day of month + \Q \E + \d{1,2}:\d{1,2}:\d{1,2}\s+ # Time + [\w\s]* # Timezone + \d{4} # Year + ) + \s+ + (?:.*) # Maintainer name + \s+ + [<\(] + (?:.*) # Maintainer email + [\)>] | # Old GNU style changelog entry with expanded date - (?: - \w+\s+ # Day of week (abbreviated) - \w+\s+ # Month name (abbreviated) - \d{1,2},?\s* # Day of month - \d{4} # Year - ) - \s+ - (?:.*) # Maintainer name - \s+ - [<\(] - (?:.*) # Maintainer email - [\)>] + (?: + \w+\s+ # Day of week (abbreviated) + \w+\s+ # Month name (abbreviated) + \d{1,2},?\s* # Day of month + \d{4} # Year + ) + \s+ + (?:.*) # Maintainer name + \s+ + [<\(] + (?:.*) # Maintainer email + [\)>] | # Ancient changelog header w/o key=value options - (?:\w[-+0-9a-z.]*) # Package name - \Q \E - \( - (?:[^\(\) \t]+) # Package version - \) - \;? + (?:\w[-+0-9a-z.]*) # Package name + \Q \E + \( + (?:[^\(\) \t]+) # Package version + \) + \;? | # Ancient changelog header - (?:[\w.+-]+) # Package name - [- ] - (?:\S+) # Package version - \ Debian - \ (?:\S+) # Package revision + (?:[\w.+-]+) # Package name + [- ] + (?:\S+) # Package version + \ Debian + \ (?:\S+) # Package revision | - Changes\ from\ version\ (?:.*)\ to\ (?:.*): + Changes\ from\ version\ (?:.*)\ to\ (?:.*): | - Changes\ for\ [\w.+-]+-[\w.+-]+:?\s*$ + Changes\ for\ [\w.+-]+-[\w.+-]+:?\s*$ | - Old\ Changelog:\s*$ + Old\ Changelog:\s*$ | - (?:\d+:)? - \w[\w.+~-]*:? - \s*$ + (?:\d+:)? + \w[\w.+~-]*:? + \s*$ ) }xi; diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm index 55d11925c..2f439091b 100644 --- a/scripts/Dpkg/Changelog/Entry/Debian.pm +++ b/scripts/Dpkg/Changelog/Entry/Debian.pm @@ -56,12 +56,12 @@ my $name_chars = qr/[-+0-9a-z.]/i; # the target distributions ($3) and the options on the rest of the line ($4). my $regex_header = qr{ ^ - (\w$name_chars*) # Package name - \ \(([^\(\) \t]+)\) # Package version - ((?:\s+$name_chars+)+) # Target distribution - \; # Separator - (.*?) # Key=Value options - \s*$ # Trailing space + (\w$name_chars*) # Package name + \ \(([^\(\) \t]+)\) # Package version + ((?:\s+$name_chars+)+) # Target distribution + \; # Separator + (.*?) # Key=Value options + \s*$ # Trailing space }xi; # The matched content is the maintainer name ($1), its email ($2), @@ -69,20 +69,20 @@ my $regex_header = qr{ # day of week ($6), date-time ($7) and this into month name ($8). my $regex_trailer = qr< ^ - \ -- # Trailer marker - \ (.*) # Maintainer name - \ \<(.*)\> # Maintainer email - (\ \ ?) # Blanks + \ -- # Trailer marker + \ (.*) # Maintainer name + \ \<(.*)\> # Maintainer email + (\ \ ?) # Blanks ( - ((\w+)\,\s*)? # Day of week (abbreviated) - ( - \d{1,2}\s+ # Day of month - (\w+)\s+ # Month name (abbreviated) - \d{4}\s+ # Year - \d{1,2}:\d\d:\d\d\s+[-+]\d{4} # ISO 8601 date - ) + ((\w+)\,\s*)? # Day of week (abbreviated) + ( + \d{1,2}\s+ # Day of month + (\w+)\s+ # Month name (abbreviated) + \d{4}\s+ # Year + \d{1,2}:\d\d:\d\d\s+[-+]\d{4} # ISO 8601 date + ) ) - \s*$ # Trailing space + \s*$ # Trailing space >x; my %week_day = map { $_ => 1 } qw(Mon Tue Wed Thu Fri Sat Sun); diff --git a/scripts/Dpkg/Deps/Simple.pm b/scripts/Dpkg/Deps/Simple.pm index 00ff40dd7..103a1a3b9 100644 --- a/scripts/Dpkg/Deps/Simple.pm +++ b/scripts/Dpkg/Deps/Simple.pm @@ -364,23 +364,23 @@ sub _restrictions_imply { my ($p, $q) = @_; if (not defined $p) { - return 1; + return 1; } elsif (not defined $q) { - return 0; + return 0; } else { - # Check whether set difference is empty. - my %restr; + # Check whether set difference is empty. + my %restr; - for my $restrlist (@{$q}) { - my $reststr = join ' ', sort @{$restrlist}; - $restr{$reststr} = 1; - } - for my $restrlist (@{$p}) { - my $reststr = join ' ', sort @{$restrlist}; - delete $restr{$reststr}; - } + for my $restrlist (@{$q}) { + my $reststr = join ' ', sort @{$restrlist}; + $restr{$reststr} = 1; + } + for my $restrlist (@{$p}) { + my $reststr = join ' ', sort @{$restrlist}; + delete $restr{$reststr}; + } - return keys %restr == 0; + return keys %restr == 0; } } diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm index d8d456c95..959daae96 100644 --- a/scripts/Dpkg/Source/Package.pm +++ b/scripts/Dpkg/Source/Package.pm @@ -263,10 +263,10 @@ sub init_options { $self->{options}{tar_ignore} = [ @tar_ignore_default_pattern ]; } push @{$self->{options}{tar_ignore}}, - 'debian/source/local-options', - 'debian/source/local-patch-header', - 'debian/files', - 'debian/files.new'; + 'debian/source/local-options', + 'debian/source/local-patch-header', + 'debian/files', + 'debian/files.new'; $self->{options}{copy_orig_tarballs} //= 0; # Skip debianization while specific to some formats has an impact diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index 1784ca396..a2defe48d 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -66,10 +66,10 @@ sub init_options { } $self->{options}{diff_ignore_regex} .= '|(?:^|/)debian/files(?:\.new)?$'; push @{$self->{options}{tar_ignore}}, - 'debian/source/local-options', - 'debian/source/local-patch-header', - 'debian/files', - 'debian/files.new'; + 'debian/source/local-options', + 'debian/source/local-patch-header', + 'debian/files', + 'debian/files.new'; $self->{options}{sourcestyle} //= 'X'; $self->{options}{skip_debianization} //= 0; $self->{options}{ignore_bad_version} //= 0; diff --git a/scripts/Dpkg/Source/Package/V3/Git.pm b/scripts/Dpkg/Source/Package/V3/Git.pm index 723424c8d..c5977f1e7 100644 --- a/scripts/Dpkg/Source/Package/V3/Git.pm +++ b/scripts/Dpkg/Source/Package/V3/Git.pm @@ -170,15 +170,14 @@ sub do_build { '-z', '--others', @ignores) or subprocerr('git ls-files'); my @files; { - local $_; - local $/ = "\0"; - while (<$git_ls_files_fh>) { - chomp; - if (! length $diff_ignore_regex || - ! m/$diff_ignore_regex/o) { - push @files, $_; - } - } + local $_; + local $/ = "\0"; + while (<$git_ls_files_fh>) { + chomp; + if (! length $diff_ignore_regex || ! m/$diff_ignore_regex/o) { + push @files, $_; + } + } } close($git_ls_files_fh) or syserr(g_('git ls-files exited nonzero')); if (@files) { diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index 8aaa178cc..6d6163127 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -406,8 +406,8 @@ sub set_build_features { # Mask features that might be influenced by other flags. if ($flags->get_option_value('optimize-level') == 0) { - # glibc 2.16 and later warn when using -O0 and _FORTIFY_SOURCE. - $use_feature{hardening}{fortify} = 0; + # glibc 2.16 and later warn when using -O0 and _FORTIFY_SOURCE. + $use_feature{hardening}{fortify} = 0; } $flags->set_option_value('fortify-level', 2); @@ -524,7 +524,7 @@ sub add_build_flags { # Warn when the __TIME__, __DATE__ and __TIMESTAMP__ macros are used. if ($flags->use_feature('reproducible', 'timeless')) { - $flags->append('CPPFLAGS', '-Wdate-time'); + $flags->append('CPPFLAGS', '-Wdate-time'); } # Avoid storing the build path in the binaries. diff --git a/scripts/Dpkg/Vendor/PureOS.pm b/scripts/Dpkg/Vendor/PureOS.pm index a492a4724..2ed609b16 100644 --- a/scripts/Dpkg/Vendor/PureOS.pm +++ b/scripts/Dpkg/Vendor/PureOS.pm @@ -49,12 +49,15 @@ sub run_hook { my $src = shift @params; my $fields = $src->{fields}; - if (defined($fields->{'Version'}) and defined($fields->{'Maintainer'}) and - $fields->{'Version'} =~ /pureos/) { - unless ($fields->{'Original-Maintainer'}) { - warning(g_('version number suggests %s vendor changes, but there is no %s field'), - 'PureOS', 'XSBC-Original-Maintainer'); - } + if (defined($fields->{'Version'}) and + defined($fields->{'Maintainer'}) and + $fields->{'Version'} =~ /pureos/) + { + unless ($fields->{'Original-Maintainer'}) { + warning(g_('version number suggests %s vendor changes, ' . + 'but there is no %s field'), + 'PureOS', 'XSBC-Original-Maintainer'); + } } } elsif ($hook eq 'keyrings') { diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm index 2aeb3d0e7..c86eee9d2 100644 --- a/scripts/Dpkg/Vendor/Ubuntu.pm +++ b/scripts/Dpkg/Vendor/Ubuntu.pm @@ -53,21 +53,28 @@ sub run_hook { # check that Maintainer/XSBC-Original-Maintainer comply to # https://wiki.ubuntu.com/DebianMaintainerField - if (defined($fields->{'Version'}) and defined($fields->{'Maintainer'}) and - $fields->{'Version'} =~ /ubuntu/) { - if ($fields->{'Maintainer'} !~ /(?:ubuntu|canonical)/i) { - if (length $ENV{DEBEMAIL} and $ENV{DEBEMAIL} =~ /\@(?:ubuntu|canonical)\.com/) { - error(g_('version number suggests %s vendor changes, but the %s field does not have %s vendor address'), - 'Ubuntu', 'Maintainer', 'Ubuntu'); - } else { - warning(g_('version number suggests %s vendor changes, but the %s field does not have %s vendor address'), - 'Ubuntu', 'Maintainer', 'Ubuntu'); - } - } - unless ($fields->{'Original-Maintainer'}) { - warning(g_('version number suggests %s vendor changes, but there is no %s field'), - 'Ubuntu', 'XSBC-Original-Maintainer'); - } + if (defined($fields->{'Version'}) and + defined($fields->{'Maintainer'}) and + $fields->{'Version'} =~ /ubuntu/) + { + if ($fields->{'Maintainer'} !~ /(?:ubuntu|canonical)/i) { + if (length $ENV{DEBEMAIL} and + $ENV{DEBEMAIL} =~ /\@(?:ubuntu|canonical)\.com/) + { + error(g_('version number suggests %s vendor changes, ' . + 'but the %s field does not have %s vendor address'), + 'Ubuntu', 'Maintainer', 'Ubuntu'); + } else { + warning(g_('version number suggests %s vendor changes, ' . + 'but the %s field does not have %s vendor address'), + 'Ubuntu', 'Maintainer', 'Ubuntu'); + } + } + unless ($fields->{'Original-Maintainer'}) { + warning(g_('version number suggests %s vendor changes, ' . + 'but there is no %s field'), + 'Ubuntu', 'XSBC-Original-Maintainer'); + } } } elsif ($hook eq 'package-keyrings') { return ($self->SUPER::run_hook($hook), @@ -171,9 +178,9 @@ sub add_build_flags { $flags->append('CXXFLAGS', $flag); $flags->append('OBJCFLAGS', $flag); $flags->append('OBJCXXFLAGS', $flag); - } + } - if (!$flags->use_feature('hardening', 'branch')) { + if (!$flags->use_feature('hardening', 'branch')) { my $cpu = $flags->get_option_value('hardening-branch-cpu'); my $flag; if ($cpu eq 'arm64') { diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl index 378deecdb..0dc4c26a3 100755 --- a/scripts/dpkg-architecture.pl +++ b/scripts/dpkg-architecture.pl @@ -239,10 +239,10 @@ while (@ARGV) { $action = 'list-known'; } elsif ($arg eq '-?' or $arg eq '--help') { usage(); - exit 0; + exit 0; } elsif ($arg eq '--version') { version(); - exit 0; + exit 0; } else { usageerr(g_("unknown option '%s'"), $arg); } diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl index c2bf75819..744e41f32 100755 --- a/scripts/dpkg-scanpackages.pl +++ b/scripts/dpkg-scanpackages.pl @@ -272,8 +272,8 @@ for my $p (sort keys %packages) { push @missingover, $p; } for my $package (sort { $a->{Version} cmp $b->{Version} } @{$packages{$p}}) { - print("$package\n") or syserr(g_('failed when writing stdout')); - $records_written++; + print("$package\n") or syserr(g_('failed when writing stdout')); + $records_written++; } } close(STDOUT) or syserr(g_("couldn't close stdout")); diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index f5eeb350e..b5233d91d 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -280,114 +280,120 @@ foreach my $file (keys %exec) { my $symfile = Dpkg::Shlibs::SymbolFile->new(); my $dumplibs_wo_symfile = Dpkg::Shlibs::Objdump->new(); SONAME: foreach my $soname (@sonames) { - # Select the first good entry from the ordered list that we got from - # find_library(), and skip to the next SONAME. + # Select the first good entry from the ordered list that we got from + # find_library(), and skip to the next SONAME. - foreach my $lib (@{$soname_libs{$soname}}) { - if (none { $_ ne '' } @{$file2pkg->{$lib}}) { - # The path of the library as calculated is not the - # official path of a packaged file, try to fallback on - # the realpath() first, maybe this one is part of a package - my $reallib = realpath($lib); - if (exists $file2pkg->{$reallib}) { - $file2pkg->{$lib} = $file2pkg->{$reallib}; - } - } - if (none { $_ ne '' } @{$file2pkg->{$lib}}) { - # If the library is really not available in an installed package, - # it's because it's in the process of being built - # Empty package name will lead to consideration of symbols - # file from the package being built only - $file2pkg->{$lib} = ['']; - debug(1, "No associated package found for $lib"); - } - - # Load symbols/shlibs files from packages providing libraries - my $missing_wanted_shlibs_info = 0; - foreach my $pkg (@{$file2pkg->{$lib}}) { - my $symfile_path; - my $haslocaldep = 0; - if (-e $shlibslocal and - defined(extract_from_shlibs($soname, $shlibslocal))) - { - $haslocaldep = 1; + foreach my $lib (@{$soname_libs{$soname}}) { + if (none { $_ ne '' } @{$file2pkg->{$lib}}) { + # The path of the library as calculated is not the + # official path of a packaged file, try to fallback on + # the realpath() first, maybe this one is part of a package + my $reallib = realpath($lib); + if (exists $file2pkg->{$reallib}) { + $file2pkg->{$lib} = $file2pkg->{$reallib}; + } } - if ($packagetype eq 'deb' and not $haslocaldep) { - # Use fine-grained dependencies only on real deb - # and only if the dependency is not provided by shlibs.local - $symfile_path = find_symbols_file($pkg, $soname, $lib); + if (none { $_ ne '' } @{$file2pkg->{$lib}}) { + # If the library is really not available in an installed + # package, it's because it's in the process of being built. + # Empty package name will lead to consideration of symbols + # file from the package being built only + $file2pkg->{$lib} = ['']; + debug(1, "No associated package found for $lib"); } - if (defined($symfile_path)) { - # Load symbol information - debug(1, "Using symbols file $symfile_path for $soname"); - $symfile_cache{$symfile_path} //= - Dpkg::Shlibs::SymbolFile->new(file => $symfile_path); - $symfile->merge_object_from_symfile($symfile_cache{$symfile_path}, $soname); + + # Load symbols/shlibs files from packages providing libraries + my $missing_wanted_shlibs_info = 0; + foreach my $pkg (@{$file2pkg->{$lib}}) { + my $symfile_path; + my $haslocaldep = 0; + if (-e $shlibslocal and + defined(extract_from_shlibs($soname, $shlibslocal))) + { + $haslocaldep = 1; + } + if ($packagetype eq 'deb' and not $haslocaldep) { + # Use fine-grained dependencies only on real deb + # and only if the dependency is not provided by shlibs.local + $symfile_path = find_symbols_file($pkg, $soname, $lib); + } + if (defined($symfile_path)) { + # Load symbol information + debug(1, "Using symbols file $symfile_path for $soname"); + $symfile_cache{$symfile_path} //= + Dpkg::Shlibs::SymbolFile->new(file => $symfile_path); + $symfile->merge_object_from_symfile($symfile_cache{$symfile_path}, $soname); + } + if (defined($symfile_path) && $symfile->has_object($soname)) { + # Initialize dependencies with the smallest minimal version + # of all symbols (unversioned dependency is not ok as the + # library might not have always been available in the + # package and we really need it) + my $dep = $symfile->get_dependency($soname); + my $minver = $symfile->get_smallest_version($soname) || ''; + update_dependency_version($dep, $minver); + debug(2, " Minimal version of ($dep) initialized with ($minver)"); + + # Found a symbols file for the SONAME. + next SONAME; + } else { + # No symbol file found, fall back to standard shlibs + debug(1, "Using shlibs+objdump for $soname (file $lib)"); + $objdump_cache{$lib} //= Dpkg::Shlibs::Objdump::Object->new($lib); + my $libobj = $objdump_cache{$lib}; + my $id = $dumplibs_wo_symfile->add_object($libobj); + if (($id ne $soname) and ($id ne $lib)) { + warning(g_('%s has an unexpected SONAME (%s)'), + $lib, $id); + $alt_soname{$id} = $soname; + } + + # Only try to generate a dependency for libraries with + # a SONAME. + if (not $libobj->is_public_library()) { + debug(1, "Skipping shlibs+objdump info for private library $lib"); + next; + } + + # If we found a shlibs file for the SONAME, skip to the + # next. + next SONAME if add_shlibs_dep($soname, $pkg, $lib); + + $missing_wanted_shlibs_info = 1; + + debug(1, "No shlibs+objdump info available, trying next package for $lib"); + } } - if (defined($symfile_path) && $symfile->has_object($soname)) { - # Initialize dependencies with the smallest minimal version - # of all symbols (unversioned dependency is not ok as the - # library might not have always been available in the - # package and we really need it) - my $dep = $symfile->get_dependency($soname); - my $minver = $symfile->get_smallest_version($soname) || ''; - update_dependency_version($dep, $minver); - debug(2, " Minimal version of ($dep) initialized with ($minver)"); - # Found a symbols file for the SONAME. - next SONAME; - } else { - # No symbol file found, fall back to standard shlibs - debug(1, "Using shlibs+objdump for $soname (file $lib)"); - $objdump_cache{$lib} //= Dpkg::Shlibs::Objdump::Object->new($lib); - my $libobj = $objdump_cache{$lib}; - my $id = $dumplibs_wo_symfile->add_object($libobj); - if (($id ne $soname) and ($id ne $lib)) { - warning(g_('%s has an unexpected SONAME (%s)'), $lib, $id); - $alt_soname{$id} = $soname; - } + next if not $missing_wanted_shlibs_info; - # Only try to generate a dependency for libraries with a SONAME - if (not $libobj->is_public_library()) { - debug(1, "Skipping shlibs+objdump info for private library $lib"); - next; - } + # We will only reach this point, if we have found no symbols nor + # shlibs files for the given SONAME. - # If we found a shlibs file for the SONAME, skip to the next. - next SONAME if add_shlibs_dep($soname, $pkg, $lib); + # This failure is fairly new, try to be kind by + # ignoring as many cases that can be safely ignored + my $ignore = 0; - $missing_wanted_shlibs_info = 1; + # 1/ when the lib and the binary are in the same + # package + my $root_file = guess_pkg_root_dir($file); + my $root_lib = guess_pkg_root_dir($lib); + $ignore++ if defined $root_file and defined $root_lib + and check_files_are_the_same($root_file, $root_lib); - debug(1, "No shlibs+objdump info available, trying next package for $lib"); - } - } + # 2/ when the lib is not versioned and can't be + # handled by shlibs + $ignore++ unless scalar split_soname($soname); - next if not $missing_wanted_shlibs_info; - - # We will only reach this point, if we have found no symbols nor - # shlibs files for the given SONAME. - - # This failure is fairly new, try to be kind by - # ignoring as many cases that can be safely ignored - my $ignore = 0; - # 1/ when the lib and the binary are in the same - # package - my $root_file = guess_pkg_root_dir($file); - my $root_lib = guess_pkg_root_dir($lib); - $ignore++ if defined $root_file and defined $root_lib - and check_files_are_the_same($root_file, $root_lib); - # 2/ when the lib is not versioned and can't be - # handled by shlibs - $ignore++ unless scalar split_soname($soname); - # 3/ when we have been asked to do so - $ignore++ if $ignore_missing_info; - if (not $ignore) { - errormsg(g_('no dependency information found for %s (used by %s)'), - $lib, $file); - hint(g_('check if the library actually comes from a package')); - exit 1; + # 3/ when we have been asked to do so + $ignore++ if $ignore_missing_info; + if (not $ignore) { + errormsg(g_('no dependency information found for %s (used by %s)'), + $lib, $file); + hint(g_('check if the library actually comes from a package')); + exit 1; + } } - } } # Scan all undefined symbols of the binary and resolve to a @@ -785,8 +791,8 @@ sub extract_from_shlibs { (\S+)\s+ # Library (\S+) # Version (?: - \s+ - (\S.*\S) # Dependencies + \s+ + (\S.*\S) # Dependencies )? \s*$ }x; diff --git a/scripts/t/Dpkg_Arch.t b/scripts/t/Dpkg_Arch.t index 714dc4a82..cb593418d 100644 --- a/scripts/t/Dpkg_Arch.t +++ b/scripts/t/Dpkg_Arch.t @@ -98,9 +98,9 @@ is_deeply(\@tuple_new, \@tuple_ref, 'valid tuple'); is_deeply(\@tuple_new, \@tuple_ref, 'valid tuple'); is(debarch_to_multiarch('i386'), 'i386-linux-gnu', - 'normalized i386 multiarch triplet'); + 'normalized i386 multiarch triplet'); is(debarch_to_multiarch('amd64'), 'x86_64-linux-gnu', - 'normalized amd64 multiarch triplet'); + 'normalized amd64 multiarch triplet'); ok(!debarch_eq('amd64', 'i386'), 'no match, simple arch'); ok(!debarch_eq('', 'amd64'), 'no match, empty first arch'); @@ -180,7 +180,7 @@ is(gnutriplet_to_debarch('x86_64-linux-gnu'), 'amd64', 'known gnutriplet'); foreach my $arch (@valid_arches) { my @tuple = debarch_to_debtuple($arch); is(debtuple_to_debarch(@tuple), $arch, - "bijective arch $arch to tuple @tuple"); + "bijective arch $arch to tuple @tuple"); my $triplet = debtuple_to_gnutriplet(@tuple); is_deeply([ gnutriplet_to_debtuple($triplet) ], \@tuple, @@ -196,5 +196,5 @@ is(scalar @valid_arches, $KNOWN_ARCHES_TOTAL, $ENV{CC} = 'echo CC'; is(get_host_gnu_type(), 'CC -dumpmachine', - 'CC does not report expected synthetic result for -dumpmachine'); + 'CC does not report expected synthetic result for -dumpmachine'); } diff --git a/scripts/t/Dpkg_BuildFlags_Ubuntu.t b/scripts/t/Dpkg_BuildFlags_Ubuntu.t index 0b29e9ff0..a4a6d4208 100644 --- a/scripts/t/Dpkg_BuildFlags_Ubuntu.t +++ b/scripts/t/Dpkg_BuildFlags_Ubuntu.t @@ -66,7 +66,7 @@ test_ltoflag($bf); # Test the overlaid Ubuntu-specific linker flag. ok($bf->get('LDFLAGS') =~ m/-Wl,-Bsymbolic-functions/, - 'LDFLAGS contains -Bsymbolic-functions'); + 'LDFLAGS contains -Bsymbolic-functions'); # Test the optimization flag override only for ppc64el. $ENV{DEB_HOST_ARCH} = 'ppc64el'; diff --git a/scripts/t/Dpkg_BuildInfo.t b/scripts/t/Dpkg_BuildInfo.t index 38e67d81d..1e801afe5 100644 --- a/scripts/t/Dpkg_BuildInfo.t +++ b/scripts/t/Dpkg_BuildInfo.t @@ -22,4 +22,4 @@ BEGIN { } is(scalar Dpkg::BuildInfo::get_build_env_allowed(), 61, - 'allowed environment variables array'); + 'allowed environment variables array'); diff --git a/scripts/t/Dpkg_BuildTypes.t b/scripts/t/Dpkg_BuildTypes.t index 26eebcbea..719572815 100644 --- a/scripts/t/Dpkg_BuildTypes.t +++ b/scripts/t/Dpkg_BuildTypes.t @@ -48,13 +48,13 @@ ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), - 'build source,all not has_all source,any'); + 'build source,all not has_all source,any'); ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); set_build_type_from_targets('build-arch,build-indep', '--targets=build-arch,build-indep', no_check => 1); is(get_build_options_from_type(), 'binary', - 'build is binary from build-arch,build-indep'); + 'build is binary from build-arch,build-indep'); ok(build_is(BUILD_BINARY), 'build is binary from build-arch,build-indep'); set_build_type_from_targets('binary', '--targets=binary', no_check => 1); @@ -71,7 +71,7 @@ ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), - 'build source,all not has_all source,any'); + 'build source,all not has_all source,any'); ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); set_build_type(BUILD_BINARY, '--build=binary', no_check => 1); diff --git a/scripts/t/Dpkg_Changelog.t b/scripts/t/Dpkg_Changelog.t index dee0a14f4..55520cbca 100644 --- a/scripts/t/Dpkg_Changelog.t +++ b/scripts/t/Dpkg_Changelog.t @@ -244,8 +244,8 @@ check_options(%ref, range => { until => '1:2.0~rc2-1sarge2' }, ($changes, $data) = setup_changelog('fields'); - my $str = $changes->format_range('dpkg', { all => 1 }); - my $expected = 'Source: fields +my $str = $changes->format_range('dpkg', { all => 1 }); +my $expected = 'Source: fields Version: 2.0-0etch1 Distribution: stable Urgency: high @@ -282,13 +282,13 @@ Xb-Userfield2: foobar Xc-Userfield: foobar '; - if ($vendor eq 'Ubuntu') { - $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 54321 424242 2424242/m; - } - cmp_ok($str, 'eq', $expected, 'fields handling'); +if ($vendor eq 'Ubuntu') { + $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 54321 424242 2424242/m; +} +cmp_ok($str, 'eq', $expected, 'fields handling'); - $str = $changes->format_range('dpkg', { offset => 1, count => 2 }); - $expected = 'Source: fields +$str = $changes->format_range('dpkg', { offset => 1, count => 2 }); +$expected = 'Source: fields Version: 2.0-1 Distribution: unstable frozen Urgency: medium @@ -315,13 +315,13 @@ Changes: Xc-Userfield: foobar '; - if ($vendor eq 'Ubuntu') { - $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 424242/m; - } - cmp_ok($str, 'eq', $expected, 'fields handling 2'); +if ($vendor eq 'Ubuntu') { + $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 424242/m; +} +cmp_ok($str, 'eq', $expected, 'fields handling 2'); - $str = $changes->format_range('rfc822', { offset => 2, count => 2 }); - $expected = 'Source: fields +$str = $changes->format_range('rfc822', { offset => 2, count => 2 }); +$expected = 'Source: fields Version: 2.0~b1-1 Distribution: unstable Urgency: low @@ -349,28 +349,28 @@ Changes: Xb-Userfield2: foobar '; - cmp_ok($str, 'eq', $expected, 'fields handling 3'); +cmp_ok($str, 'eq', $expected, 'fields handling 3'); - # Test Dpkg::Changelog::Entry methods - is($data->[1]->get_version(), '2.0-1', 'get_version'); - is($data->[1]->get_source(), 'fields', 'get_source'); - is(scalar $data->[1]->get_distributions(), 'unstable', 'get_distribution'); - is(join('|', $data->[1]->get_distributions()), 'unstable|frozen', - 'get_distributions'); - is($data->[3]->get_optional_fields(), - "Urgency: high\nCloses: 1000000\nXb-Userfield2: foobar\n", - 'get_optional_fields'); - is($data->[1]->get_maintainer(), 'Frank Lichtenheld <dj...@debian.org>', - 'get_maintainer'); - is($data->[1]->get_timestamp(), 'Sun, 12 Jan 2008 15:49:19 +0100', - 'get_timestamp'); - my @items = $data->[1]->get_change_items(); - is($items[0], " [ Frank Lichtenheld ]\n", 'change items 1'); - is($items[4], ' * New upstream release. +# Test Dpkg::Changelog::Entry methods +is($data->[1]->get_version(), '2.0-1', 'get_version'); +is($data->[1]->get_source(), 'fields', 'get_source'); +is(scalar $data->[1]->get_distributions(), 'unstable', 'get_distribution'); +is(join('|', $data->[1]->get_distributions()), 'unstable|frozen', + 'get_distributions'); +is($data->[3]->get_optional_fields(), + "Urgency: high\nCloses: 1000000\nXb-Userfield2: foobar\n", + 'get_optional_fields'); +is($data->[1]->get_maintainer(), 'Frank Lichtenheld <dj...@debian.org>', + 'get_maintainer'); +is($data->[1]->get_timestamp(), 'Sun, 12 Jan 2008 15:49:19 +0100', + 'get_timestamp'); +my @items = $data->[1]->get_change_items(); +is($items[0], " [ Frank Lichtenheld ]\n", 'change items 1'); +is($items[4], ' * New upstream release. - implements a - implements b ', 'change items 2'); - is($items[5], " * Update S-V.\n", 'change items 3'); +is($items[5], " * Update S-V.\n", 'change items 3'); ## File: date-format @@ -405,7 +405,6 @@ is("$f->{Version}", '0', 'version 0 correctly parsed'); foreach my $test (([ "$datadir/misplaced-tz", 6 ], [ "$datadir/unreleased", 5, 7 ])) { - my $file = shift @$test; my $changes = Dpkg::Changelog::Debian->new(verbose => 0); $changes->load($file); diff --git a/scripts/t/Dpkg_Checksums.t b/scripts/t/Dpkg_Checksums.t index 7686ce00d..1969a2630 100644 --- a/scripts/t/Dpkg_Checksums.t +++ b/scripts/t/Dpkg_Checksums.t @@ -144,5 +144,5 @@ $ck->export_to_control($ctrl_export); foreach my $alg (keys %str_checksum) { is($ctrl_export->{"Checksums-$alg"}, $str_checksum{$alg}, - "Export checksum $alg to a control object"); + "Export checksum $alg to a control object"); } diff --git a/scripts/t/Dpkg_Control_Fields.t b/scripts/t/Dpkg_Control_Fields.t index e064e231c..734583704 100644 --- a/scripts/t/Dpkg_Control_Fields.t +++ b/scripts/t/Dpkg_Control_Fields.t @@ -482,9 +482,9 @@ is(field_get_default_value('Priority'), 'optional', 'default value for Priority field'); is(field_capitalize('invented-field'), 'Invented-Field', - 'Field Invented-Field capitalization'); + 'Field Invented-Field capitalization'); ok(!field_is_official('invented-field'), - 'Field Invented-Field is not official'); + 'Field Invented-Field is not official'); my %known_fields; foreach my $type (sort keys %fields) { diff --git a/scripts/t/Dpkg_Deps.t b/scripts/t/Dpkg_Deps.t index 6c601498a..5507d4516 100644 --- a/scripts/t/Dpkg_Deps.t +++ b/scripts/t/Dpkg_Deps.t @@ -30,7 +30,7 @@ is(deps_concat(undef), '', 'Concatenate list with undef'); is(deps_concat(''), '', 'Concatenate an empty string'); is(deps_concat('', undef), '', 'Concatenate empty string with undef'); is(deps_concat('dep-a', undef, 'dep-b'), 'dep-a, dep-b', - 'Concatenate two strings with intermixed undef'); + 'Concatenate two strings with intermixed undef'); sub test_dep_parse_option { my %opts = @_; @@ -300,31 +300,31 @@ my $field_virtual = 'myvirtual | other'; my $dep_virtual = deps_parse($field_virtual); $dep_virtual->simplify_deps($facts); is($dep_virtual->output(), '', - 'Simplify unversioned depends with unversioned virtual (satisfied)'); + 'Simplify unversioned depends with unversioned virtual (satisfied)'); $field_virtual = 'myvirtual (>= 1.0) | other'; $dep_virtual = deps_parse($field_virtual); $dep_virtual->simplify_deps($facts); is($dep_virtual->output(), 'myvirtual (>= 1.0) | other', - 'Simplify versioned depends on unversioned virtual (unsatisfied)'); + 'Simplify versioned depends on unversioned virtual (unsatisfied)'); $field_virtual = 'myvirtual2 (>= 0.0) | other'; $dep_virtual = deps_parse($field_virtual); $dep_virtual->simplify_deps($facts); is($dep_virtual->output(), '', - 'Simplify versioned depends on versioned virtual (satisfied)'); + 'Simplify versioned depends on versioned virtual (satisfied)'); $field_virtual = 'myvirtual2 (>= 2.0) | other'; $dep_virtual = deps_parse($field_virtual); $dep_virtual->simplify_deps($facts); is($dep_virtual->output(), 'myvirtual2 (>= 2.0) | other', - 'Simplify versioned depends on versioned virtual (unsatisfied)'); + 'Simplify versioned depends on versioned virtual (unsatisfied)'); $field_virtual = 'myvirtual3 (= 2.0-1)'; $dep_virtual = deps_parse($field_virtual); $dep_virtual->simplify_deps($facts); is($dep_virtual->output(), 'myvirtual3 (= 2.0-1)', - 'Simplify versioned depends on GT versioned virtual (unsatisfied/ignored)'); + 'Simplify versioned depends on GT versioned virtual (unsatisfied/ignored)'); my $field_dup_union = 'libc6 (>> 2.3), libc6 (>= 2.6-1), fake (<< 2.0), fake(>> 3.0), fake (= 2.5), python (<< 2.5), python (= 2.4)'; @@ -344,7 +344,7 @@ is("$dep_red", $dep_red->output(), 'Stringification == output()'); my $dep_profiles = deps_parse('dupe <stage1 cross>, dupe <stage1 cross>'); $dep_profiles->simplify_deps($facts); is($dep_profiles->output(), 'dupe <stage1 cross>', - 'Simplification respects duplicated profiles'); + 'Simplification respects duplicated profiles'); TODO: { @@ -353,15 +353,15 @@ local $TODO = 'not yet implemented'; $dep_profiles = deps_parse('tool <!cross>, tool <stage1 cross>'); $dep_profiles->simplify_deps($facts); is($dep_profiles->output(), 'tool <!cross> <stage1 cross>', - 'Simplify restriction formulas'); + 'Simplify restriction formulas'); } # TODO $dep_profiles = deps_parse('libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>', build_dep => 1); $dep_profiles->simplify_deps($facts); is($dep_profiles->output(), - 'libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>', - 'Simplification respects archqualifiers and profiles'); + 'libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>', + 'Simplification respects archqualifiers and profiles'); my $dep_archqual = deps_parse('pkg, pkg:any'); $dep_archqual->simplify_deps($facts); @@ -403,7 +403,7 @@ is($dep_sloppy_arch->output(), 'package [alpha]', 'sloppy arch restriction'); my $dep_sloppy_profile = deps_parse('package < !profile > < other >'); is($dep_sloppy_profile->output(), 'package <!profile> <other>', - 'sloppy profile restriction'); + 'sloppy profile restriction'); $SIG{__WARN__} = sub {}; diff --git a/scripts/t/Dpkg_Source_Archive.t b/scripts/t/Dpkg_Source_Archive.t index 20c6cf89d..17a0b8e42 100644 --- a/scripts/t/Dpkg_Source_Archive.t +++ b/scripts/t/Dpkg_Source_Archive.t @@ -76,7 +76,7 @@ sub test_path_escape )) == 0 or die "cannot create overlay tar archive\n"; - # This is the expected directory, which we'll be comparing against. + # This is the expected directory, which we'll be comparing against. make_path($expdir); system('cp', '-RPp', $overdir, $expdir) == 0 or die "cannot copy overlay hierarchy into expected directory\n"; @@ -109,11 +109,11 @@ sub test_path_escape # Check results ok(length $warnseen && $warnseen =~ m/points outside source root/, - 'expected warning seen'); + 'expected warning seen'); ok(system($Dpkg::PROGTAR, '--compare', '-f', "$expdir.tar", '-C', $treedir) == 0, - 'expected directory matches'); + 'expected directory matches'); ok(! -e "$outdir/escaped-file", - 'expected output directory is empty, directory traversal'); + 'expected output directory is empty, directory traversal'); } test_path_escape('in-place'); diff --git a/scripts/t/Dpkg_Source_Package.t b/scripts/t/Dpkg_Source_Package.t index 305f2b145..710915208 100644 --- a/scripts/t/Dpkg_Source_Package.t +++ b/scripts/t/Dpkg_Source_Package.t @@ -46,7 +46,7 @@ is($p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.sig", $as OPENPGP_OK, 'conversion from binary sig to armored asc'); ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 0, - 'binary signature converted to OpenPGP ASCII Armor'); + 'binary signature converted to OpenPGP ASCII Armor'); # Grab the output messages. eval { @@ -56,6 +56,6 @@ eval { }; ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 0, - 'OpenPGP ASCII Armor copied to destination'); + 'OpenPGP ASCII Armor copied to destination'); # TODO: Add actual test cases. diff --git a/scripts/t/Dpkg_Source_Patch.t b/scripts/t/Dpkg_Source_Patch.t index 7ca8b09fd..c92a62564 100644 --- a/scripts/t/Dpkg_Source_Patch.t +++ b/scripts/t/Dpkg_Source_Patch.t @@ -57,7 +57,7 @@ test_patch_escape('index-+++', 'symlink', 'index-+++.patch', test_patch_escape('index-inert', 'symlink', 'index-inert.patch', 'patch(1) should not fail to apply using an inert Index:'); ok(-e "$tmpdir/index-inert-tree/inert-file", - 'patch(1) applies correctly with inert Index:'); + 'patch(1) applies correctly with inert Index:'); # This is CVE-2014-3864 test_patch_escape('partial', 'symlink', 'partial.patch', diff --git a/scripts/t/Dpkg_Substvars.t b/scripts/t/Dpkg_Substvars.t index f9d142978..6904a6974 100644 --- a/scripts/t/Dpkg_Substvars.t +++ b/scripts/t/Dpkg_Substvars.t @@ -113,7 +113,7 @@ is($s->get('ctrl:Alter-Field'), 'alter-value', 'contents of ctrl:Alter-Field'); # Direct replace: few is($s->substvars('This is a string ${var1} with variables ${binary:Version}'), 'This is a string New value with variables 1:2.3.4~5-6.7.8~nmu9+b0', - 'direct replace, few times'); + 'direct replace, few times'); # Direct replace: many times (more than the recursive limit) $s->set('dr', 'feed'); @@ -141,14 +141,14 @@ is($s->substvars('This is a string with unknown variable ${blubb}'), 'substvars missing'); delete $SIG{__WARN__}; is($output, - 'Dpkg_Substvars.t: warning: test substitution variable ${blubb} used, but is not defined' . "\n", - 'missing variables warning'); + 'Dpkg_Substvars.t: warning: test substitution variable ${blubb} used, but is not defined' . "\n", + 'missing variables warning'); # Recursive replace: Simple. $s->set('rvar', 'recursive ${var1}'); is($s->substvars('This is a string with ${rvar}'), 'This is a string with recursive New value', - 'recursive replace simple'); + 'recursive replace simple'); # Recursive replace: Constructed variables. $s->set('partref', 'recursive result'); @@ -157,7 +157,7 @@ $s->set('part2', 'rtr'); $s->set('part3', 'ef}'); is($s->substvars('Constructed ${part1}${part2}${part3} replace'), 'Constructed recursive result replace', - 'recursive constructed variable'); + 'recursive constructed variable'); # Recursive replace: Cycle. $s->set('ref0', '${ref1}'); @@ -170,9 +170,9 @@ eval { }; $output = $@ // q{}; is($output, - 'Dpkg_Substvars.t: error: test too many ${ref0} substitutions ' . - "(recursive?) in 'Cycle reference \${ref1}'\n", - 'recursive cyclic expansion is limited'); + 'Dpkg_Substvars.t: error: test too many ${ref0} substitutions ' . + "(recursive?) in 'Cycle reference \${ref1}'\n", + 'recursive cyclic expansion is limited'); # Recursive replace: Billion laughs. $s->set('ex0', ':)'); @@ -192,39 +192,39 @@ eval { }; $output = $@ // q{}; is($output, - 'Dpkg_Substvars.t: error: test too many ${ex1} substitutions ' . - "(recursive?) in 'Billion laughs :):):):):):):):):):):):):):)" . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . - ':):):):):):):):):):):):):):):):):):):):):):):):):):)' . - '${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}' . - '${ex2}${ex2}${ex2}${ex2}${ex2}' . - '${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}' . - '${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}' . - '${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}' . - '${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}' . - '${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}' . - '${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}' . - "'\n", - 'recursive or exponential expansion is limited'); + 'Dpkg_Substvars.t: error: test too many ${ex1} substitutions ' . + "(recursive?) in 'Billion laughs :):):):):):):):):):):):):):)" . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):):):):):)' . + ':):):):):):):):):):):):):):):):):):):):):):):):):):)' . + '${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}${ex0}' . + '${ex2}${ex2}${ex2}${ex2}${ex2}' . + '${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}${ex3}' . + '${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}${ex4}' . + '${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}${ex5}' . + '${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}${ex6}' . + '${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}${ex7}' . + '${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}${ex8}' . + "'\n", + 'recursive or exponential expansion is limited'); # Strange input is($s->substvars('Nothing to $ ${substitute here}, is it ${}?, it ${is'), 'Nothing to $ ${substitute here}, is it ${}?, it ${is', - 'substvars strange'); + 'substvars strange'); # Warnings about unused variables $output = ''; @@ -232,8 +232,8 @@ $SIG{__WARN__} = sub { $output .= $_[0] }; $s->warn_about_unused(); delete $SIG{__WARN__}; is($output, - 'Dpkg_Substvars.t: warning: test substitution variable ${var2} unused, but is defined' . "\n", - 'unused variables warnings'); + 'Dpkg_Substvars.t: warning: test substitution variable ${var2} unused, but is defined' . "\n", + 'unused variables warnings'); # Disable warnings for a certain variable $s->set_as_used('var_used', 'used'); @@ -257,7 +257,7 @@ is($sr->output(), $expected, 'Required variable preserved'); is($sr->substvars('This is a string with missing the required variable'), 'This is a string with missing the required variable', - 'substvars required substitution missing'); + 'substvars required substitution missing'); eval { $sr->warn_about_unused(); @@ -265,8 +265,8 @@ eval { }; $output = $@ // q{}; is($output, - 'Dpkg_Substvars.t: error: required substitution variable ${required-var} not used' . "\n", - 'substvars required substitution not used'); + 'Dpkg_Substvars.t: error: required substitution variable ${required-var} not used' . "\n", + 'substvars required substitution not used'); is($sr->substvars('This is a string with a required variable ${required-var}'), 'This is a string with a required variable Required value', diff --git a/scripts/t/Dpkg_Version.t b/scripts/t/Dpkg_Version.t index 41df1e5d4..8e65343be 100644 --- a/scripts/t/Dpkg_Version.t +++ b/scripts/t/Dpkg_Version.t @@ -39,28 +39,28 @@ plan tests => scalar(@tests) * (3 * scalar(@ops) + 4) + 27; my $have_dpkg = can_run('dpkg'); sub dpkg_vercmp { - my ($a, $cmp, $b) = @_; - my $stderr; + my ($a, $cmp, $b) = @_; + my $stderr; - spawn(exec => [ 'dpkg', '--compare-versions', '--', $a, $cmp, $b ], - error_to_string => \$stderr, wait_child => 1, no_check => 1); - diag("dpkg --compare-versions error=$?: $stderr") if $? and $? != 256; + spawn(exec => [ 'dpkg', '--compare-versions', '--', $a, $cmp, $b ], + error_to_string => \$stderr, wait_child => 1, no_check => 1); + diag("dpkg --compare-versions error=$?: $stderr") if $? and $? != 256; - return $? == 0; + return $? == 0; } sub obj_vercmp { - my ($a, $cmp, $b) = @_; - return $a < $b if $cmp eq '<<'; - return $a lt $b if $cmp eq 'lt'; - return $a <= $b if $cmp eq '<=' or $cmp eq '<'; - return $a le $b if $cmp eq 'le'; - return $a == $b if $cmp eq '='; - return $a eq $b if $cmp eq 'eq'; - return $a >= $b if $cmp eq '>=' or $cmp eq '>'; - return $a ge $b if $cmp eq 'ge'; - return $a > $b if $cmp eq '>>'; - return $a gt $b if $cmp eq 'gt'; + my ($a, $cmp, $b) = @_; + return $a < $b if $cmp eq '<<'; + return $a lt $b if $cmp eq 'lt'; + return $a <= $b if $cmp eq '<=' or $cmp eq '<'; + return $a le $b if $cmp eq 'le'; + return $a == $b if $cmp eq '='; + return $a eq $b if $cmp eq 'eq'; + return $a >= $b if $cmp eq '>=' or $cmp eq '>'; + return $a ge $b if $cmp eq 'ge'; + return $a > $b if $cmp eq '>>'; + return $a gt $b if $cmp eq 'gt'; } my $truth = { -- Dpkg.Org's dpkg