Fri 26 Feb 2016 02:01:18 PM UTC, original submission:
Lots of people have had issues with trying to parse the output of dmidecode when it issues a warning about the version of SMBIOS.
This is a small patch that will print the warning to stderr instead of stdout, to allow scripts to read the values without having to parse out the warning text:
Patched version is 2.12 as that was what affected me at the moment.
--- dmidecode.c.orig 2016-02-26 14:36:59.074461389 +0100
+++ dmidecode.c 2016-02-26 14:51:28.228558667 +0100
@@ -4330,7 +4330,7 @@
if (ver > SUPPORTED_SMBIOS_VER)
{
- printf("# SMBIOS implementations newer than version %u.%u are not\n"
+ fprintf(stderr, "# SMBIOS implementations newer than version %u.%u are not\n"
"# fully supported by this version of dmidecode.\n",
SUPPORTED_SMBIOS_VER >> 8, SUPPORTED_SMBIOS_VER & 0xFF);
}
The difference is subtle but important...
root@localhost:~# X=$(/usr/sbin/dmidecode.orig -s system-uuid)
root@localhost:~# echo $X
# SMBIOS implementations newer than version 2.7 are not # fully supported by this version of dmidecode. 60AD2F7C-FB44-400F-BDBC-1D6A66BE3C80
VS
root@localhost:~# X=$(/usr/sbin/dmidecode -s system-uuid)
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
root@localhost:~# echo $X
60AD2F7C-FB44-400F-BDBC-1D6A66BE3C80
|