[dpkg] 104/192: Dpkg::Compression::FileHandle: Only load POSIX if we need signal handling

Ximin Luo infinity0 at debian.org
Tue Oct 17 11:04:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 6217726eb5cfbc3b1ea4603b69bcb43881f29cbd
Author: Guillem Jover <guillem at debian.org>
Date:   Fri Jul 14 00:35:11 2017 +0200

    Dpkg::Compression::FileHandle: Only load POSIX if we need signal handling
    
    If we are not using signal handling code we should not be imposing the
    additional load times over most modules using the transparent compression
    support, which currently includes all Dpkg::Control users.
---
 debian/changelog                       | 2 ++
 scripts/Dpkg/Compression/FileHandle.pm | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c06258a..e4da204 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
     - Remove unused POSIX module imports.
     - Use Errno module instead of the slow to import POSIX.
     - Remove unused Dpkg::Path from Dpkg::Vendor::Ubuntu.
+    - Only load POSIX from Dpkg::Compression::FileHandle if we are going to
+      use signal definitions, reducing the load time of many other modules.
   * Documentation:
     - Document currently accepted syntax for changelogs in deb-changelog(5).
       Closes: #858579
diff --git a/scripts/Dpkg/Compression/FileHandle.pm b/scripts/Dpkg/Compression/FileHandle.pm
index d7014e8..23b3984 100644
--- a/scripts/Dpkg/Compression/FileHandle.pm
+++ b/scripts/Dpkg/Compression/FileHandle.pm
@@ -21,7 +21,6 @@ use warnings;
 
 our $VERSION = '1.01';
 
-use POSIX qw(:signal_h :sys_wait_h);
 use Carp;
 
 use Dpkg::Compression;
@@ -432,7 +431,9 @@ sub _cleanup {
     my $cmdline = *$self->{compressor}{cmdline} // '';
     *$self->{compressor}->wait_end_process(nocheck => *$self->{allow_sigpipe});
     if (*$self->{allow_sigpipe}) {
-        unless (($? == 0) || (WIFSIGNALED($?) && (WTERMSIG($?) == SIGPIPE))) {
+        require POSIX;
+        unless (($? == 0) || (POSIX::WIFSIGNALED($?) &&
+                              (POSIX::WTERMSIG($?) == POSIX::SIGPIPE()))) {
             subprocerr($cmdline);
         }
 	*$self->{allow_sigpipe} = 0;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list