From fbfbb9c9a8620caf4aa0d8ea90b86abd3c189d50 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 11 Sep 2013 12:07:25 +0000 Subject: [PATCH] sensors-detect: Fix use of uninitialized value 'vendor_id' on ppc64 Based on a report and an original patch from Jaromir Capik: There's no vendor_id entry in the /proc/cpuinfo file in case of PPC64 systems and consequently the script returns 3 screens full of the following errors: Use of uninitialized value in string eq at /usr/sbin/sensors-detect line 6444 Use of uninitialized value in string eq at /usr/sbin/sensors-detect line 6459 Use of uninitialized value in string eq at /usr/sbin/sensors-detect line 6473 --- CHANGES | 1 + prog/detect/sensors-detect | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index a6d7ed84..d58edf9e 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ SVN HEAD Introduce automatic mode (--auto) Detect incorrect non-interactive runs Rework option handling + Fix use of uninitialized value 'vendor_id' on ppc64 3.3.4 (2013-05-27) sensors.conf.5: Mention "sensors -u" to get the raw feature names diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index a0f763b2..f12f9837 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2694,7 +2694,10 @@ sub initialize_cpu_list while () { if (m/^processor\s*:\s*(\d+)/) { push @cpu, $entry if scalar keys(%{$entry}); # Previous entry - $entry = { nr => $1 }; # New entry + $entry = { # New entry + nr => $1, + vendor_id => "undefined", + }; next; } if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) {