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 16a7938c..2a4aedf7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +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 ] diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index fd8b4d73..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"); diff --git a/lib/Sbuild/ChrootUnshare.pm b/lib/Sbuild/ChrootUnshare.pm index 8516e50e..4125438c 100644 --- a/lib/Sbuild/ChrootUnshare.pm +++ b/lib/Sbuild/ChrootUnshare.pm @@ -228,11 +228,17 @@ sub chroot_auto_create { $dist = $newdist; } - my @commonargs = ( - $self->get_conf("MMDEBSTRAP"), - "--variant=buildd", "--arch=$arch", "--skip=output/mknod", - "--format=tar", $basedist, - ); + my @commonargs = (); + if (length $self->get_conf('UNSHARE_MMDEBSTRAP_ENV_CMD')) { + push(@commonargs, @{ $self->get_conf('UNSHARE_MMDEBSTRAP_ENV_CMD') }); + } + push( + @commonargs, + ( + $self->get_conf("MMDEBSTRAP"), "--variant=buildd", + "--arch=$arch", "--skip=output/mknod", + "--format=tar", $basedist, + )); if ($self->get_conf('UNSHARE_MMDEBSTRAP_KEEP_TARBALL')) { # the tarball is supposed to be kept but maybe we don't need to # create one because the existing one is new enough diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm index 8446fbe0..3e00ad2f 100644 --- a/lib/Sbuild/Conf.pm +++ b/lib/Sbuild/Conf.pm @@ -401,15 +401,15 @@ $unshare_mmdebstrap_extra_args = [ "{jessie,stretch}-amd64" => [ ... ] # the same as above but with a glob instead of a regex ];' }, - 'UNSHARE_MMDEBSTRAP_ENV_CMND' => { + 'UNSHARE_MMDEBSTRAP_ENV_CMD' => { TYPE => 'ARRAY', - VARNAME => 'unshare_mmdebstrap_env_cmnd', + VARNAME => 'unshare_mmdebstrap_env_cmd', GROUP => 'Chroot options (unshare)', DEFAULT => [], HELP => 'This is an experimental feature. In unshare mode, when mmdebstrap is used to create the chroot environment, prefix that command with this option array.', EXAMPLE => - '$unshare_mmdebstrap_env_cmnd = [ "env", "TMPDIR=/dev/shm/" ];' + '$unshare_mmdebstrap_env_cmd = [ "env", "TMPDIR=/dev/shm/" ];' }, 'UNSHARE_MMDEBSTRAP_MAX_AGE' => { TYPE => 'NUMERIC', 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") {

