tags 376020 + patch fixed-upstream pending
thanks

Roger Leigh <[EMAIL PROTECTED]> writes:

> Ideally, we should be able to replace the use of sudo with su (inside
> the chroot) when using sudo on the host system.  See Sbuild/Chroot.pm,
> lines 250-256.

The attached patch fixes the problem with the environment being
stripped inside the chroot.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 830)
+++ debian/changelog	(working copy)
@@ -1,3 +1,14 @@
+sbuild (0.48) unstable; urgency=low
+
+  * Sbuild/Chroot.pm: Use su, rather than sudo, inside the chroot.  This
+    prevents the APT_CONFIG and DEBCONF_FRONTEND environment variables
+    from being removed (Closes: #376020).
+  * Sbuild/Conf.pm: Add $Sbuild::Conf::su.
+  * sbuild-setup.7.in: Remove sudo configuration inside the chroot, now
+    this is no longer required.
+
+ -- Roger Leigh <[EMAIL PROTECTED]>  Sun,  9 Jul 2006 18:18:33 +0100
+
 sbuild (0.47) unstable; urgency=low
 
   * bin/checkchroot: Correct uninitialised value warnings due to using an
Index: Sbuild/Conf.pm
===================================================================
--- Sbuild/Conf.pm	(revision 830)
+++ Sbuild/Conf.pm	(working copy)
@@ -33,15 +33,15 @@
     @ISA = qw(Exporter);
 
     @EXPORT = qw($HOME $cwd $username $verbose $nolog
-		 $source_dependencies $mailprog $dpkg $sudo $schroot
-		 $schroot_options $fakeroot $apt_get $apt_cache
-		 $dpkg_source $md5sum $avg_time_db $avg_space_db
-		 $build_env_cmnd $pgp_options $log_dir $mailto
-		 $mailfrom $purge_build_directory @toolchain_regex
-		 $stalled_pkg_timeout $srcdep_lock_dir
-		 $srcdep_lock_wait $chroot_only $chroot_mode
-		 @ignore_watches_no_build_deps $build_dir $sbuild_mode
-		 $debug $force_orig_source
+		 $source_dependencies $mailprog $dpkg $sudo $su
+		 $schroot $schroot_options $fakeroot $apt_get
+		 $apt_cache $dpkg_source $md5sum $avg_time_db
+		 $avg_space_db $build_env_cmnd $pgp_options $log_dir
+		 $mailto $mailfrom $purge_build_directory
+		 @toolchain_regex $stalled_pkg_timeout
+		 $srcdep_lock_dir $srcdep_lock_wait $chroot_only
+		 $chroot_mode @ignore_watches_no_build_deps $build_dir
+		 $sbuild_mode $debug $force_orig_source
 		 %individual_stalled_pkg_timeout $path
 		 $maintainer_name $uploader_name $key_id);
 }
@@ -59,6 +59,7 @@
 our $mailprog = "/usr/sbin/sendmail";
 our $dpkg = "/usr/bin/dpkg";
 our $sudo = "/usr/bin/sudo";
+our $su = "/bin/su";
 our $schroot = "/usr/bin/schroot";
 our $schroot_options = "-q";
 our $fakeroot = "/usr/bin/fakeroot";
Index: Sbuild/Chroot.pm
===================================================================
--- Sbuild/Chroot.pm	(revision 830)
+++ Sbuild/Chroot.pm	(working copy)
@@ -246,13 +246,9 @@
 	my $cmdline;
 	if ($chroot != 0) { # Run command inside chroot
 		if ($Sbuild::Conf::chroot_mode eq "schroot") {
-			$cmdline = "$Sbuild::Conf::schroot -c $schroot_session --run-session $Sbuild::Conf::schroot_options -u $user -p -- ";
+			$cmdline = "$Sbuild::Conf::schroot -c $schroot_session --run-session $Sbuild::Conf::schroot_options -u $user -p -- /bin/sh -c '$command'";
 		} else {
-			$cmdline = "$Sbuild::Conf::sudo /usr/sbin/chroot $$current{'Location'} $Sbuild::Conf::sudo ";
-			if ($user ne "root") {
-				$cmdline .= "-u $Sbuild::Conf::username ";
-			}
-			$cmdline .= "-H ";
+			$cmdline = "$Sbuild::Conf::sudo /usr/sbin/chroot $$current{'Location'} $Sbuild::Conf::su -p $user -c '$command'";
 		}
 	} else { # Run command outside chroot
 		if ($user ne $Sbuild::Conf::username) {
@@ -261,8 +257,8 @@
 				$cmdline .= "-u $Sbuild::Conf::username ";
 			}
 		}
+		$cmdline .= "/bin/sh -c '$command'";
 	}
-	$cmdline .= "/bin/sh -c '$command'";
 
 	return $cmdline;
 }
Index: sbuild-setup.7.in
===================================================================
--- sbuild-setup.7.in	(revision 830)
+++ sbuild-setup.7.in	(working copy)
@@ -175,7 +175,7 @@
 the debconf install.  Next, install the packages required for building
 packages:
 .PP
-\f[CR]# \f[CB]apt\-get install sudo debfoster fakeroot build\-essential\fP\fP
+\f[CR]# \f[CB]apt\-get install debfoster fakeroot build\-essential\fP\fP
 .br
 \f[CR]# \f[CB]apt\-get install makedev\fP\fP
 .br
@@ -256,7 +256,6 @@
 .br
 .PP
 where \fIusername\fP is the name of the user who will run sbuild.
-\fI/etc/sudoers\fP inside the chroot also needs the same modifications.
 .SS 5. Finished
 You should now be able to run sbuild.
 .PP

Attachment: pgpqeW4Pwfqme.pgp
Description: PGP signature

Reply via email to