Hi,

I forgot that renaming UNSHARE_MMDEBSTRAP_ENV_CMND actually changes /etc/sbuild.conf and I don't think we won't this in a stable update. Luckily this change is not really needed either so I have pushed deb13u4 to fix this. For completeness I attach the diff against deb13u1. The rest of the initial bug report text still applies. Sorry for the extra work.

Cheers Jochen

* Jochen Sprickerhof <[email protected]> [2025-12-27 22:38]:
Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: [email protected]
Control: affects -1 + src:sbuild
User: [email protected]
Usertags: pu

[ Reason ]
This is a follow up to deb13u2 fixing some more edge cases and should
simplify deploying sbuild on the porterboxes.

[ Impact ]
Porterboxes need more configuration without this.

[ Tests ]
Autopkgtest

[ Risks ]
None, all patches change manual behavior or special conditions.

[ Checklist ]
 [X] *all* changes are documented in the d/changelog
 [X] I reviewed all changes and I approve them
 [X] attach debdiff against the package in (old)stable
 [X] the issue is verified as fixed in unstable

[ Changes ]
- Actually use UNSHARE_MMDEBSTRAP_ENV_CMD:
 Previously there was a UNSHARE_MMDEBSTRAP_ENV_CMND option but it was
 never used. Based on on feedback by Holger we renamed it to
 UNSHARE_MMDEBSTRAP_ENV_CMD (in lib/Sbuild/Conf.pm) and actually
 apply it to the mmdebstrap command (push(@commonargs in
 lib/Sbuild/ChrootUnshare.pm).
- preserve TMPDIR for piuparts:
 This is is the same as we did for autopkgtest in deb13u2, i.e. pass
 $TMPDIR to piuparts.
- Obey $TMPDIR for autopkgtest dsc mkdtemp (+ fix):
 Switch from mkdtemp() to tempdir() to obey $TMPDIR.
- Initialize variable:
 This fixes a warning when /etc/subuid is empty.

diff --git a/debian/changelog b/debian/changelog
index f4c17a60..e369ab75 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,32 @@
+sbuild (0.89.3+deb13u4) trixie; urgency=medium
+
+  * Revert "Actually use UNSHARE_MMDEBSTRAP_ENV_CMD"
+
+ -- Jochen Sprickerhof <[email protected]>  Sun, 28 Dec 2025 14:49:34 +0100
+
+sbuild (0.89.3+deb13u3) trixie; urgency=medium
+
+  * Actually use UNSHARE_MMDEBSTRAP_ENV_CMD
+  * lib/Sbuild/Build.pm: preserve TMPDIR for piuparts
+  * Obey $TMPDIR for autopkgtest dsc mkdtemp
+  * Fix tempdir for autopkgtest
+  * Initialize variable
+
+ -- Jochen Sprickerhof <[email protected]>  Sat, 27 Dec 2025 21:42:04 +0100
+
+sbuild (0.89.3+deb13u2) trixie; urgency=medium
+
+  [ Jochen Sprickerhof ]
+  * Explicitly select the sbuild-build-depends-main-dummy package arch
+    (Closes: #1119344)
+
+  [ Johannes Schauer Marin Rodrigues ]
+  * lib/Sbuild/Build.pm: preserve TMPDIR when running autopkgtest
+    (Closes: #1121503)
+  * lib/Sbuild/Build.pm: perltidy
+
+ -- Jochen Sprickerhof <[email protected]>  Fri, 28 Nov 2025 09:43:59 +0100
+
 sbuild (0.89.3+deb13u1) trixie; urgency=medium
 
   [ Richard Lewis ]
diff --git a/lib/Sbuild/AptResolver.pm b/lib/Sbuild/AptResolver.pm
index d422014d..90a1e9e1 100644
--- a/lib/Sbuild/AptResolver.pm
+++ b/lib/Sbuild/AptResolver.pm
@@ -57,6 +57,7 @@ sub install_deps {
 	my $status         = 0;
 	my $session        = $self->get('Session');
 	my $dummy_pkg_name = $self->get_sbuild_dummy_pkg_name($name);
+	my $arch           = $self->get('Host Arch');
 
 	# Call functions to setup an archive to install dummy package.
 	$self->log_subsubsection("Setup apt archive");
@@ -77,7 +78,8 @@ sub install_deps {
 	# Install the dummy package
 	my (@instd, @rmvd);
 	$self->log("Installing build dependencies\n");
-	my @apt_args = ("-yf", \@instd, \@rmvd, 'install', $dummy_pkg_name);
+	my @apt_args
+	  = ("-yf", \@instd, \@rmvd, 'install', "$dummy_pkg_name:$arch");
 
 	if (!$self->run_apt(@apt_args)) {
 		$self->log_error("Package installation failed\n");
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 30e2ef96..e4d95bae 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -29,7 +29,7 @@ use English;
 use POSIX;
 use Errno qw(:POSIX);
 use Fcntl;
-use File::Temp     qw(mkdtemp);
+use File::Temp     qw(tempdir);
 use File::Basename qw(basename dirname);
 use FileHandle;
 use File::Copy qw();    # copy is already exported from Sbuild, so don't export
@@ -2099,8 +2099,9 @@ sub run_piuparts {
 	  if ($self->get_conf('PIUPARTS_OPTIONS'));
 	push @piuparts_command, $self->get('Changes File');
 	$self->get('Host')->run_command({
-		COMMAND  => \@piuparts_command,
-		PRIORITY => 0,
+		COMMAND    => \@piuparts_command,
+		ENV_FILTER => ['^TMPDIR$'],
+		PRIORITY   => 0,
 	});
 	my $status = $? >> 8;
 
@@ -2183,7 +2184,7 @@ sub run_autopkgtest {
 			# sbuild got passed a source package name and downloaded that
 			# itself, so it must be made available to the host
 			my $build_dir = $self->get('Build Dir');
-			$tmpdir = mkdtemp("/tmp/tmp.sbuild.XXXXXXXXXX");
+			$tmpdir = tempdir("tmp.sbuild.XXXXXXXXXX", TMPDIR => 1);
 			if (!$session->copy_from_chroot("$build_dir/$dsc", "$tmpdir/$dsc"))
 			{
 				$self->log_error("cannot copy .dsc from chroot\n");
@@ -2214,8 +2215,9 @@ sub run_autopkgtest {
 		push @autopkgtest_command, '--', 'null';
 	}
 	$self->get('Host')->run_command({
-		COMMAND  => \@autopkgtest_command,
-		PRIORITY => 0,
+		COMMAND    => \@autopkgtest_command,
+		ENV_FILTER => ['^TMPDIR$'],
+		PRIORITY   => 0,
 	});
 	my $status = $? >> 8;
 	# if the source package wasn't built and also initially downloaded by
diff --git a/lib/Sbuild/Utility.pm b/lib/Sbuild/Utility.pm
index 038854d8..e8f63638 100644
--- a/lib/Sbuild/Utility.pm
+++ b/lib/Sbuild/Utility.pm
@@ -389,7 +389,8 @@ use constant { PER_LINUX32 => 0x0008, };
 
 sub read_subuid_subgid() {
 	my $username = getpwuid $<;
-	my ($subid, $num_subid, $fh, $n);
+	my ($subid, $num_subid, $fh);
+	my $n      = -1;
 	my @result = ();
 
 	if (!-e "/etc/subuid") {

Attachment: signature.asc
Description: PGP signature

Reply via email to