The following commit has been merged in the master branch:
commit 90baddbae257b517cd09a3a6b5d03a40cadd58d6
Author: Guillem Jover <[email protected]>
Date:   Fri Jan 4 10:59:36 2013 +0100

    dpkg-shlibdeps: Do not use readline operator in a foreach loop
    
    These are very slow as the list context forces the operator to read
    the entire stream before starting the loop.
    
    Fixes InputOutput::ProhibitReadlineInForLoop.
    
    Warned-by: perlcritic

diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 92480cf..468203a 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -454,7 +454,8 @@ if ($stdout) {
     if (-e $varlistfile) {
        open(my $old_fh, '<', $varlistfile) ||
            syserr(_g("open old varlist file \`%s' for reading"), $varlistfile);
-       foreach my $entry (grep { not m/^\Q$varnameprefix\E:/ } (<$old_fh>)) {
+       while (my $entry = <$old_fh>) {
+           next if $entry =~ m/^\Q$varnameprefix\E:/;
            print($new_fh $entry) ||
                syserr(_g("copy old entry to new varlist file \`%s'"),
                       "$varlistfile.new");
diff --git a/test/100_critic.t b/test/100_critic.t
index c034c51..671c6d3 100644
--- a/test/100_critic.t
+++ b/test/100_critic.t
@@ -55,6 +55,7 @@ my @policies = qw(
     InputOutput::ProhibitInteractiveTest
     InputOutput::ProhibitJoinedReadline
     InputOutput::ProhibitOneArgSelect
+    InputOutput::ProhibitReadlineInForLoop
     InputOutput::ProhibitTwoArgOpen
     InputOutput::RequireEncodingWithUTF8Layer
     Miscellanea::ProhibitFormats

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to