Source: sbuild
Version: git
Severity: minor

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,
while trying to catch up with a mipsel (--arch=mips2) building of
packages which for obvious reasons need to stay seperate from anything 
Debian official i tried using buildd to build all and mipsel arch
at the same time. 

Resulting packages were uploaded correctly but sometimes throw
a perl error on buildd-uploader

Use of uninitialized value in concatenation (.) or string at 
/usr/share/perl5/Buildd/Base.pm line 166.
Use of uninitialized value in concatenation (.) or string at 
/usr/share/perl5/Buildd/Base.pm line 169.
Can't call method "get" on an undefined value at 
/usr/share/perl5/Sbuild/Base.pm line 74.

Debugging the issue it turned out the

        Buildd::Uploader->upload

had a different assumption about the calling convention for

        Buildd::Uploader->uploaded

The first thought it should pass in an array (Which arch_name suddenly
became) but ->uploaded only expected a scalar. It passed it to 

        Buildd::Base::get_arch_dist_config_by_name()

which failed horribly.

So i propose a patch something like this:

https://salsa.debian.org/flo/sbuild/-/commit/cc095b20ad225b48d56a362d0cf3a219c6cf9246


commit cc095b20ad225b48d56a362d0cf3a219c6cf9246
Author: Florian Lohoff <f...@zz.de>
Date:   Thu Jan 26 13:15:26 2023 +0100

    Fix passing argument mismatch
    
    Buildd::Uploader->uploaded takes an scalar argument for the architecture
    whereas Buildd::Uploader->upload passes in an array. This breaks when
    something really writes more than one architecture in the .changes file.
    
    Convert to pass by reference and before passing to
    
            ->get_arch_dist_config_by_name()
    
    eliminate possible "all" from the list when there is more than one
    architecture in the array.

diff --git a/lib/Buildd/Uploader.pm b/lib/Buildd/Uploader.pm
index 302f5da0..a05cef94 100644
- --- a/lib/Buildd/Uploader.pm
+++ b/lib/Buildd/Uploader.pm
@@ -83,9 +83,13 @@ sub run {
 sub uploaded ($@) {
     my $self = shift;
     my $pkg = shift;
- -    my $arch_name = shift;
+    my $arch_array = shift;
     my $dist_name = shift;
 
+    my $arch_name=(scalar @{$arch_array} > 1)
+        ? (grep { !/all/ } @{$arch_array})[0]
+        : $arch_array->[0];
+
     my $msgs = "";
 
     my $dist_config = $self->get_arch_dist_config_by_name($arch_name, 
$dist_name);
@@ -180,7 +184,7 @@ sub upload ($$) {
            } else {
                ($pkg = $f) =~ s/_\S+\.changes$//;
            }
- -         $self->uploaded($pkg, @archs, @dists);
+           $self->uploaded($pkg, \@archs, @dists);
        } else {
            push (@after, $f);
        }




-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEdb9o7oebX2papQ/KkN1BIMsJ8i8FAmPScekACgkQkN1BIMsJ
8i9lhRAAg9l2YsF+zOsvPEqHdMUprmm/uEuAdMFGtJt3L+6BlRvWBXBuz7xZ0FzY
OqxOuPUS6PSnfreLgfsgLbfSyPVGgZ6Vlh6u7XzNBhdn/W/ErbTqRv39J9qDgcwY
9JAZc4NxmEFasAF5QQqwjj65S31LoXHAhSB4d5/AMai5kIWu7SgfYLFoAZ1DIrul
WZS9DDo2Yu4cMP+sZdZ+d8OhdFUph4crBusXmSrXQSI8BTFSj0pt5FXQKuSETRmH
iC2yOIeAPJNbHnkGpdo/KF6nyv9LoEwslqp22bigEqquH17U/VaQoV+yCCD94S0N
JhjVTqqywAGtlh0Z+lntAmA7c7P3Sd/YlcA9waCjxBppsEJ8PXZUQYVcFDPpYRM2
yePhnM93YSTlptZ49iujKHdqwT44WAb8KJT0eBH7In15nJVF32kxSV90RYex5QPG
Degx5A0yCRwHpRLjYG8L+3kQJ+9UP6Y2g+pDgxmI437k+gs3kT7tLjNjUupnw/Ej
3TWBjbdVWZggRVOMlUvpHgbBUJ19yNXjljP971tWVn80bCTudSoL8a7D+gkOkoxL
kB66VhRTuw72Cg5fTY5JbHmLbJGPxp2Vi6Dv2ebTmg7E0p3JiEcQ1iiT15s/jxK2
PK+rc7Rd7k6WGFbqrc3xZuFWIsDJI4zKL9p8HoIzu+DkWxYM1LI=
=P1aT
-----END PGP SIGNATURE-----

Reply via email to