The following commit has been merged in the master branch:
commit f1d3f2dae6581d04743fa4877f78d44be66502df
Author: Raphael Hertzog <hert...@debian.org>
Date:   Mon Mar 16 10:54:05 2009 +0100

    Dpkg::IPC: add sanity check for timeout parameter and a non-regression test

diff --git a/scripts/Dpkg/IPC.pm b/scripts/Dpkg/IPC.pm
index 88fde22..52ca9f5 100644
--- a/scripts/Dpkg/IPC.pm
+++ b/scripts/Dpkg/IPC.pm
@@ -157,6 +157,11 @@ sub _sanity_check_opts {
        }
     }
 
+    if (exists $opts{"timeout"} and defined($opts{"timeout"}) and
+        $opts{"timeout"} !~ /^\d+$/) {
+       internerr("parameter timeout must be an integer");
+    }
+
     if (exists $opts{"env"} and ref($opts{"env"}) ne 'HASH') {
        internerr("parameter env must be a hash reference");
     }
diff --git a/scripts/t/800_Dpkg_IPC.t b/scripts/t/800_Dpkg_IPC.t
index 85435ae..3b952c2 100644
--- a/scripts/t/800_Dpkg_IPC.t
+++ b/scripts/t/800_Dpkg_IPC.t
@@ -1,6 +1,6 @@
 # -*- mode: cperl -*-
 
-use Test::More tests => 7;
+use Test::More tests => 8;
 
 use strict;
 use warnings;
@@ -45,7 +45,8 @@ is($string2, $string, "{from,to}_handle");
 $pid = fork_and_exec(exec => "cat",
                     from_file => $tmp_name,
                     to_file => $tmp2_name,
-                    wait_child => 1);
+                    wait_child => 1,
+                    timeout => 5);
 
 ok($pid);
 
@@ -55,5 +56,12 @@ close TMP;
 
 is($string2, $string, "{from,to}_file");
 
+eval {
+    $pid = fork_and_exec(exec => ["sleep", "10"],
+                        wait_child => 1,
+                        timeout => 5);
+};
+ok($@, "fails on timeout");
+
 unlink($tmp_name);
 unlink($tmp2_name);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to