Просмотр исходного кода

Dpkg::IPC::fork_and_exec(): put modified environment variables in error messages

The descriptive command-line given to wait_child() now also includes the
environment variables that have been set since they may affect the
behaviour of the executed command and are likely needed to reproduce the
problem.

With this change, the quilt failures within dpkg-source are better
identified: QUILT_PATCHES can be checked to know if it was working
on the main tree or the temporary one and QUILT_PATCH_OPTS is
seen by users who can then independently reproduce the failure (and not
wonder why they can't reproduce it).
Raphaël Hertzog лет назад: 16
Родитель
Сommit
7169f0d3cf
2 измененных файлов с 10 добавлено и 1 удалено
  1. 3 0
      debian/changelog
  2. 7 1
      scripts/Dpkg/IPC.pm

+ 3 - 0
debian/changelog

@@ -16,6 +16,9 @@ dpkg (1.15.5.3) UNRELEASED; urgency=low
   * Before accepting to build a 3.0 (quilt) source packages, ensure that
     debian/patches is a directory (or non-existing) and that
     debian/patches/series is a file (or non-existing). Closes: #557618
+  * Dpkg::IPC::fork_and_exec() now includes the changed environment
+    variables in the default error message displayed when the sub-process
+    fails.
 
   [ Guillem Jover ]
   * Verify that the alternative used in update-alternatives --set has been

+ 7 - 1
scripts/Dpkg/IPC.pm

@@ -278,8 +278,14 @@ sub fork_and_exec {
 	${$opts{"error_to_string"}} = readline($error_to_string_pipe);
     }
     if ($opts{"wait_child"}) {
+	my $cmdline = "@prog";
+	if ($opts{"env"}) {
+	    foreach (keys %{$opts{"env"}}) {
+		$cmdline = "$_=\"" . $opts{"env"}{$_} . "\" $cmdline";
+	    }
+	}
 	wait_child($pid, nocheck => $opts{"nocheck"},
-                   timeout => $opts{"timeout"}, cmdline => "@prog");
+                   timeout => $opts{"timeout"}, cmdline => $cmdline);
 	return 1;
     }