Bug#1026927: needrestart -b on AMD processors complains of perl uninitialized variable
On Fri, 06 Jan 2023 01:56:33 -0700, Patrick Matthäi wrote: > Thanks for your investigation. I have tested it on my (sid/unstable) AMD > notebook and I can reproduce your issue with needrestart from stable. > But your patch does not produce another result for me. Are you sure, > that you didnt changed something else? Color me confused. That file (in fact that one character) is all I changed. I tried it again and the patch seems to work for me. What I did was: apt-get install --reinstall needrestart needrestart -b # error message apply patch needrestart -b # no error here I'm attaching a full `script` of that attempt in case there's something significant in there that the above summary leaves out. That also has md5sum of AMD.pm before and after the patch in case that helps point to "what's different" between our two runs. If there's any more info I can supply, please let me know. Thanks for looking into this. Thanks, George Script started on 2023-01-09 12:32:39-07:00 [TERM="xterm" TTY="/dev/pts/0" COLUMNS="80" LINES="24"] root@xecty# PS1='# ' # apt-get install --reinstall needrestart Reading package lists... 0% Reading package lists... 100% Reading package lists... Done Building dependency tree... 0% Building dependency tree... 0% Building dependency tree... 50% Building dependency tree... 50% Building dependency tree... Done Reading state information... 0% Reading state information... 0% Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 0 B/62.4 kB of archives. After this operation, 0 B of additional disk space will be used. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 59046 files and directories currently installed.) Preparing to unpack .../needrestart_3.5-4+deb11u2_all.deb ... Unpacking needrestart (3.5-4+deb11u2) over (3.5-4+deb11u2) ... Setting up needrestart (3.5-4+deb11u2) ... Processing triggers for man-db (2.9.4-2) ... NEEDRESTART-VER: 3.5 NEEDRESTART-KCUR: 5.10.0-20-amd64 NEEDRESTART-KEXP: 5.10.0-20-amd64 NEEDRESTART-KSTA: 1 NEEDRESTART-UCSTA: 1 NEEDRESTART-UCCUR: 0x0327 Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 904. NEEDRESTART-UCEXP: # # # needrestart -b NEEDRESTART-VER: 3.5 NEEDRESTART-KCUR: 5.10.0-20-amd64 NEEDRESTART-KEXP: 5.10.0-20-amd64 NEEDRESTART-KSTA: 1 NEEDRESTART-UCSTA: 1 NEEDRESTART-UCCUR: 0x0327 Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 904. NEEDRESTART-UCEXP: # cd /usr/share/perl5/NeedRestart/uCode/ # cat ~ghr/needrestart.patch --- /tmp/AMD.pm 2022-12-22 11:00:14.589106185 -0700 +++ /usr/share/perl5/NeedRestart/uCode/AMD.pm 2022-12-22 11:00:24.329046436 -0700 @@ -179,7 +179,7 @@ if ( exists( $_ucodes->{cpuid}->{$cpuid} ) ) { my $prid = $_ucodes->{cpuid}->{$cpuid}; if ( exists( $_ucodes->{prid}->{$prid} ) ) { -$vars{AVAIL} = sprintf( "0x%08x", $_ucodes->{prid}->{$prid} ), +$vars{AVAIL} = sprintf( "0x%08x", $_ucodes->{prid}->{$prid} ); print STDERR "$LOGPREF #$info->{processor} found ucode $vars{AVAIL}\n" if ($debug); if ( $_ucodes->{prid}->{$prid} > $ucode ) { # md5sum AMD.pm aa911d7cb8c97f464db89f0252ecaf73 AMD.pm # patch -p6 <~ghr/needrestart.patch patching file AMD.pm # md5sum AMD.pm 2be0d48086c482f6425e9626f73afbb9 AMD.pm # needrestart -b NEEDRESTART-VER: 3.5 NEEDRESTART-KCUR: 5.10.0-20-amd64 NEEDRESTART-KEXP: 5.10.0-20-amd64 NEEDRESTART-KSTA: 1 NEEDRESTART-UCSTA: 1 NEEDRESTART-UCCUR: 0x0327 NEEDRESTART-UCEXP: 0x0327 # exit Script done on 2023-01-09 12:33:54-07:00 [COMMAND_EXIT_CODE="0"]
Bug#1026927: needrestart -b on AMD processors complains of perl uninitialized variable
Hey Am 24.12.22 um 02:25 schrieb George Robbert: Package: needrestart Version: 3.5-4+deb11u2 Severity: normal Dear Maintainer, When running 'needrestart -b' on an AMD system, I get the following uninitialized variable warning. It also does not report the expected microcode version (NEEDRESTART-UCEXP). See output: section below for example output of needrestart -b. Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 904. This perl warning disappears when adding the -v option (needrestart -b -v), and the correct value is reported for NEEDRESTART-UCEXP. The processor, in this system, is: vendor_id : AuthenticAMD cpu family : 18 model : 1 model name : AMD A4-3400 APU with Radeon(tm) HD Graphics stepping: 0 microcode : 0x327 It looks to me like the problem is that line 182 of /usr/share/perl5/NeedRestart/uCode/AMD.pm ends in a comma (,) instead of a semicolon (;). This means that assignment is subsumed into the next line which is under if ($debug). See the attached patch. Thanks for your investigation. I have tested it on my (sid/unstable) AMD notebook and I can reproduce your issue with needrestart from stable. But your patch does not produce another result for me. Are you sure, that you didnt changed something else? OpenPGP_0x12D9B04A90CBD8E4.asc Description: OpenPGP public key OpenPGP_signature Description: OpenPGP digital signature
Bug#1026927: needrestart -b on AMD processors complains of perl uninitialized variable
Package: needrestart Version: 3.5-4+deb11u2 Severity: normal Dear Maintainer, When running 'needrestart -b' on an AMD system, I get the following uninitialized variable warning. It also does not report the expected microcode version (NEEDRESTART-UCEXP). See output: section below for example output of needrestart -b. Use of uninitialized value $ucode_vars{"AVAIL"} in concatenation (.) or string at /usr/sbin/needrestart line 904. This perl warning disappears when adding the -v option (needrestart -b -v), and the correct value is reported for NEEDRESTART-UCEXP. The processor, in this system, is: vendor_id : AuthenticAMD cpu family : 18 model : 1 model name : AMD A4-3400 APU with Radeon(tm) HD Graphics stepping: 0 microcode : 0x327 It looks to me like the problem is that line 182 of /usr/share/perl5/NeedRestart/uCode/AMD.pm ends in a comma (,) instead of a semicolon (;). This means that assignment is subsumed into the next line which is under if ($debug). See the attached patch. It also looks to me like this is similar symptoms with a different root cause from bug #973050. Thanks, George Robbert -- Package-specific info: needrestart output: -- System Information: Debian Release: 11.1 Architecture: amd64 (x86_64) Kernel: Linux 5.10.0-20-amd64 (SMP w/2 CPU threads) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: sysvinit (via /sbin/init) Versions of packages needrestart depends on: ii binutils 2.35.2-2 ii dpkg 1.20.12 ii gettext-base 0.21-4 ii libintl-perl 1.26-3+deb11u1 ii libmodule-find-perl0.15-1 ii libmodule-scandeps-perl1.30-1 ii libproc-processtable-perl 0.59-2+b1 ii libsort-naturally-perl 1.03-2 ii libterm-readkey-perl 2.38-1+b2 ii perl 5.32.1-4+deb11u2 ii xz-utils 5.2.5-2.1~deb11u1 Versions of packages needrestart recommends: ii libpam-elogind [libpam-systemd] 246.10-2 ii sysvinit-core2.96-7+devuan2 Versions of packages needrestart suggests: pn iucode-tool pn needrestart-session | libnotify-bin -- Configuration Files: /etc/apt/apt.conf.d/99needrestart changed: DPkg::Post-Invoke {"test -x /usr/lib/needrestart/apt-pinvoke && /usr/lib/needrestart/apt-pinvoke -b || true"; }; /etc/needrestart/hook.d/20-rpm [Errno 2] No such file or directory: '/etc/needrestart/hook.d/20-rpm' -- no debconf information --- /tmp/AMD.pm 2022-12-22 11:00:14.589106185 -0700 +++ /usr/share/perl5/NeedRestart/uCode/AMD.pm 2022-12-22 11:00:24.329046436 -0700 @@ -179,7 +179,7 @@ if ( exists( $_ucodes->{cpuid}->{$cpuid} ) ) { my $prid = $_ucodes->{cpuid}->{$cpuid}; if ( exists( $_ucodes->{prid}->{$prid} ) ) { -$vars{AVAIL} = sprintf( "0x%08x", $_ucodes->{prid}->{$prid} ), +$vars{AVAIL} = sprintf( "0x%08x", $_ucodes->{prid}->{$prid} ); print STDERR "$LOGPREF #$info->{processor} found ucode $vars{AVAIL}\n" if ($debug); if ( $_ucodes->{prid}->{$prid} > $ucode ) {