[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.10-3-g3c351b6



The following commit has been merged in the master branch:
commit 3c351b692b94ee7daf3cab55efb018685900cefb
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Jul 10 14:12:41 2012 +0200

    c/manpages: Manual redirect & chdir when invoking man
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/manpages b/checks/manpages
index 94ebdb3..cdf6e74 100644
--- a/checks/manpages
+++ b/checks/manpages
@@ -233,22 +233,36 @@ foreach my $file ($info->sorted_index) {
         # parent directory before running man so that .so directives are
         # processed properly.  (Yes, there are man pages that include other
         # pages with .so but aren't simple links; rbash, for instance.)
-        my $cmd;
+        my @cmd = ('man', '--warnings', '-E', 'UTF-8', '-l');
+        my $dir;
         if ($path =~ m,^(.*)/(man\d/.*)$,) {
-            $cmd = "cd \Q$1\E && man --warnings -E UTF-8 -l \Q$2\E";
+            $dir = $1;
+            push @cmd, $2;
         } else {
-            $cmd = "man --warnings -E UTF-8 -l \Q$path\E";
+            push @cmd, $path;
         }
-        my $pid = open MANERRS, '-|';
+        my ($read, $write);
+        pipe ($read, $write) or fail "pipe failed: $!";
+        my $pid = fork;
         if (not defined $pid) {
-            fail("cannot run man -E UTF-8 -l: $!");
+            fail "fork failed: $!";
         } elsif ($pid == 0) {
             clean_env;
+            close STDOUT;
+            close $read;
+            open STDERR, '>&', $write
+                or fail "Redirecting STDERR: $!";
+            if ($dir) {
+                chdir $dir or fail "chdir $dir: $!";
+            }
             $ENV{MANWIDTH} = 80;
-            exec "($cmd >/dev/null) 2>&1"
+            exec { $cmd[0] } @cmd
                 or fail("cannot run man -E UTF-8 -l: $!");
+        } else {
+            # parent - close write end
+            close $write;
         }
-        while (<MANERRS>) {
+        while (<$read>) {
             # ignore progress information from man
             next if /^Reformatting/;
             next if /^\s*$/;
diff --git a/debian/changelog b/debian/changelog
index edf4994..e92c39d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,9 @@ lintian (2.5.11) UNRELEASED; urgency=low
     + [NT] Mention that cme can automate fixing some perl
       related tags.  Thanks to gregor herrmann for the report
       and patch.  (Closes: #680446)
+  * checks/manpages:
+    + [NT] Manually do redirects and chdir rather than invoking
+      a shell when calling man.
 
  -- Niels Thykier <niels@thykier.net>  Tue, 10 Jul 2012 13:21:56 +0200
 

-- 
Debian package checker


Reply to: