[kernel] r15474 - dists/sid/linux-2.6/debian

Ben Hutchings benh at alioth.debian.org
Sat Apr 3 03:29:00 UTC 2010


Author: benh
Date: Sat Apr  3 03:28:51 2010
New Revision: 15474

Log:
linux-base: Redirect stdin and stdout of child processes to avoid interfering with debconf (Closes: #574987)

Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/linux-base.postinst

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Sat Apr  3 02:38:13 2010	(r15473)
+++ dists/sid/linux-2.6/debian/changelog	Sat Apr  3 03:28:51 2010	(r15474)
@@ -20,6 +20,8 @@
     - Never during a fresh installation (Closes: #576243)
   * phylib: Support PHY module autoloading (Closes: #553024)
   * linux-base: Convert disk IDs in crypttab (Closes: #575056)
+  * linux-base: Redirect stdin and stdout of child processes to avoid
+    interfering with debconf (Closes: #574987)
 
   [ maximilian attems]
   * [alpha, hppa] Disable oprofile as tracing code is unsupported here.

Modified: dists/sid/linux-2.6/debian/linux-base.postinst
==============================================================================
--- dists/sid/linux-2.6/debian/linux-base.postinst	Sat Apr  3 02:38:13 2010	(r15473)
+++ dists/sid/linux-2.6/debian/linux-base.postinst	Sat Apr  3 03:28:51 2010	(r15474)
@@ -24,6 +24,31 @@
 use POSIX ();
 use UUID;
 
+# Since debconf clients get their standard input and output redirected
+# to the debconf front-end, we need to redirect them again before
+# running any other program.
+sub _system {
+    my $pid = fork();
+    die "$!" unless defined($pid);
+    if ($pid == 0) {
+       # </dev/null
+       POSIX::close(0);
+       POSIX::open('/dev/null', POSIX::O_RDONLY) or die "$!";
+       # >&2
+       POSIX::dup2(2, 1) or die "$!";
+       exec(@_);
+       exit(255); # usual exit code for failed exec
+    } else {
+       waitpid($pid, 0);
+       # The built-in system() function does this substitution
+       if (POSIX::WIFEXITED($?) && POSIX::WEXITSTATUS($?) == 255) {
+	   return -1;
+       } else {
+	   return $?;
+       }
+    }
+}
+
 package DebianKernel::DiskId;
 
 ### utility
@@ -319,7 +344,7 @@
 }
 
 sub grub1_post {
-    system('update-grub');
+    _system('update-grub');
 }
 
 ### GRUB 2 config
@@ -356,7 +381,7 @@
 }
 
 sub grub2_post {
-    system('grub-mkconfig', '-o', '/boot/grub/grub.cfg');
+    _system('grub-mkconfig', '-o', '/boot/grub/grub.cfg');
 }
 
 ### LILO
@@ -519,19 +544,19 @@
 }
 
 sub lilo_post {
-    system('lilo');
+    _system('lilo');
 }
 
 ### SILO
 
 sub silo_post {
-    system('silo');
+    _system('silo');
 }
 
 ### ELILO
 
 sub elilo_post {
-    system('elilo');
+    _system('elilo');
 }
 
 ### extlinux
@@ -594,7 +619,7 @@
 }
 
 sub extlinux_post {
-    system('update-extlinux');
+    _system('update-extlinux');
 }
 
 # udev persistent-cd
@@ -944,40 +969,40 @@
 
 sub ext2_set_label {
     my ($bdev, $label) = @_;
-    system('tune2fs', '-L', $label, $bdev) == 0 or die "tune2fs failed: $?";
+    _system('tune2fs', '-L', $label, $bdev) == 0 or die "tune2fs failed: $?";
 }
 sub ext2_set_uuid {
     my ($bdev, $uuid) = @_;
-    system('tune2fs', '-U', $uuid, $bdev) == 0 or die "tune2fs failed: $?";
+    _system('tune2fs', '-U', $uuid, $bdev) == 0 or die "tune2fs failed: $?";
 }
 
 sub jfs_set_label {
     my ($bdev, $label) = @_;
-    system('jfs_tune', '-L', $label, $bdev) == 0 or die "jfs_tune failed: $?";
+    _system('jfs_tune', '-L', $label, $bdev) == 0 or die "jfs_tune failed: $?";
 }
 sub jfs_set_uuid {
     my ($bdev, $uuid) = @_;
-    system('jfs_tune', '-U', $uuid, $bdev) == 0 or die "jfs_tune failed: $?";
+    _system('jfs_tune', '-U', $uuid, $bdev) == 0 or die "jfs_tune failed: $?";
 }
 
 sub fat_set_label {
     my ($bdev, $label) = @_;
-    system('dosfslabel', $bdev, $label) == 0 or die "dosfslabel failed: $?";
+    _system('dosfslabel', $bdev, $label) == 0 or die "dosfslabel failed: $?";
 }
 
 sub ntfs_set_label {
     my ($bdev, $label) = @_;
-    system('ntfslabel', $bdev, $label) == 0 or die "ntfslabel failed: $?";
+    _system('ntfslabel', $bdev, $label) == 0 or die "ntfslabel failed: $?";
 }
 
 sub reiserfs_set_label {
     my ($bdev, $label) = @_;
-    system('reiserfstune', '--label', $label, $bdev)
+    _system('reiserfstune', '--label', $label, $bdev)
 	or die "reiserfstune failed: $?";
 }
 sub reiserfs_set_uuid {
     my ($bdev, $uuid) = @_;
-    system('reiserfstune', '--uuid', $uuid, $bdev)
+    _system('reiserfstune', '--uuid', $uuid, $bdev)
 	or die "reiserfstune failed: $?";
 }
 
@@ -1041,16 +1066,16 @@
 
 sub ufs_set_label {
     my ($bdev, $label) = @_;
-    system('tunefs.ufs', '-L', $label, $bdev) or die "tunefs.ufs failed: $?";
+    _system('tunefs.ufs', '-L', $label, $bdev) or die "tunefs.ufs failed: $?";
 }
 
 sub xfs_set_label {
     my ($bdev, $label) = @_;
-    system('xfs_admin', '-L', $label, $bdev) or die "xfs_admin failed: $?";
+    _system('xfs_admin', '-L', $label, $bdev) or die "xfs_admin failed: $?";
 }
 sub xfs_set_uuid {
     my ($bdev, $uuid) = @_;
-    system('xfs_admin', '-U', $uuid, $bdev) or die "xfs_admin failed: $?";
+    _system('xfs_admin', '-U', $uuid, $bdev) or die "xfs_admin failed: $?";
 }
 
 my %filesystem_types = (



More information about the Kernel-svn-changes mailing list