maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #13354
Re: MTR fails on undefined {cpus} array in My/SysInfo.pm on armhf and armel
> Can't use an
> undefined value as an ARRAY reference at lib/My/SysInfo.pm line 166.
>
> # Return the number of
> cpus found
> sub num_cpus {
> my ($self)= @_;
> return int(@{$self->{cpus}}) or
>
> confess "INTERNAL ERROR: No cpus in list"; }
>
>
> Can somebody with strong Perl
> skills help me understand
> 1) Where this cpus array is inherited from?
It's not inherited, $self is an "anonymous hash"
Observe:
root:~$ perl -Mstrict -le 'my $self={a=>"b"};print scalar(@{$self->{cpus}}) '
Can't use an undefined value as an ARRAY reference at -e line 1.
root:~$ perl -Mstrict -le 'my $self={a=>"b"};print scalar(@{$self->{cpus} || []}) '
0
So adding these " || []" will avoid the error ([] means anonymous array aka list)
root:~$ perl -Mstrict -le 'my $self={a=>"b",cpus=>["a","b","c"]};print scalar(@{$self->{cpus} || []}) '
3
> 2) Why
> might it have now regressed in MariaDB 10.11.3 and why is this erroring only on
> armel/armhf but not other architectures?
I can't answer this question right now, sorry, need some deeper investigation which I can't
right now but can try later.
> 3) What should I do wrap this section
> in so that if cpus is not set, it would just default to '1'?
Add this line before the troublesome line:
return 1 unless $self->{cpus};
best regards,
Vadim
References