Hey, Just like with the previous bug (#1026927), it looks like there's more to this one. Trying the patch on several more systems I run into the same symptoms on some. Again, these have the same symptoms but differing causes (full patch included). What I found was:
On an intel system, where uCode/AMD.pm was run before uCode/Intel.pm intel_sys1# needrestart -b NEEDRESTART-VER: 3.6 NEEDRESTART-KCUR: 6.1.0-18-amd64 NEEDRESTART-KEXP: 6.1.0-18-amd64 NEEDRESTART-KSTA: 1 NEEDRESTART-UCSTA: 1 Use of uninitialized value $ucode_vars{"CURRENT"} in concatenation (.) or string at /usr/sbin/needrestart line 940. NEEDRESTART-UCCUR: Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 941. NEEDRESTART-UCEXP: But we don't get the 'Use of uninitialized value' when run as `needrestart -b -v`. The issue here is that nr_ucode_check keeps going after the "eval ... ${pkg}::nr_ucode_check_real..." fails unless $debug is set. Thus, without $debug, thi saves off the unintialized values from AMD.pm as "the good ones", so we get the error. On a VM running with an AMD processor but without package amd64-microcode, and also directly on an AMD system with a processor new enough that it does not have a microcode version lin amd64-microcode, I get the following identical results. amd_vm1# needrestart -b NEEDRESTART-VER: 3.6 NEEDRESTART-KCUR: 6.1.0-18-amd64 NEEDRESTART-KEXP: 6.1.0-18-amd64 NEEDRESTART-KSTA: 1 NEEDRESTART-UCSTA: 1 NEEDRESTART-UCCUR: 0xa0011d1 Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 941. NEEDRESTART-UCEXP: amd_sys3# needrestart -b NEEDRESTART-VER: 3.6 NEEDRESTART-KCUR: 6.1.0-18-amd64 NEEDRESTART-KEXP: 6.1.0-18-amd64 NEEDRESTART-KSTA: 1 NEEDRESTART-UCSTA: 1 NEEDRESTART-UCCUR: 0x6006705 Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 941. NEEDRESTART-UCEXP: This comes from AMD.pm not setting $ucode_vars{"AVAIL"} if it doesn't find any matching available versions. compare_ucode_versions() handles, this as expected, but leaves $ucode_vars{"AVAIL"} unset to cause problems later when run with -b. The attached patch fixes includes the previous patch and also fixes these 2 issues. Hope this helps, George
--- /tmp/uCode.pm.dist 2024-02-13 09:20:29.236867717 -0700 +++ /usr/share/perl5/NeedRestart/uCode.pm 2024-02-13 09:33:23.099742955 -0700 @@ -152,10 +152,15 @@ # call ucode modules foreach my $pkg (@PKGS) { + eval "${pkg}::nr_ucode_init();"; + if ( $@ ) { + print STDERR $@ if ($debug); + next; + } my @nvars; eval "\@nvars = ${pkg}::nr_ucode_check_real(\$debug, \$ui, \$processors{\$pid});"; - if ( $@ && $debug ) { - print STDERR $@; + if ( $@ ) { + print STDERR $@ if ($debug); $ui->progress_step; next; } @@ -174,6 +179,10 @@ $ui->progress_fin; + if ( $state == NRM_CURRENT && ! grep ( ( $_ eq "AVAIL"), @vars ) ) { + push(@vars, "AVAIL", "unavailable"); + } + return ( $state, @vars ); }