Bug #9049
closedsmbios(1M) confusingly uses literal tabs in output strings
100%
Description
While using the smbios command, I noticed something odd. The main thing was that the output when it dumped hex data was not aligned. For example, consider the following:
ID SIZE TYPE 57600 38 SMB_TYPE_OEM_LO+97 (type 225) offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: e10d00e1 01010004 00020104 00435055 .............CPU 0x10: 2e536f63 6b65742e 31004350 552e536f .Socket.1.CPU.So 0x20: 636b6574 2e32 cket.2
Notice how the offset line is further indented from everything else. When I went looking at the code, I found a rather perculiar format string. Notable it looked like:
oprintf(fp, "\n offset: 0 1 2 3 4 5 6 7 8 9 a b c d e f "
However, the first character after the \n was a tab character and not a space. Looking at this further, I found this had changed with illumos#5094. And in fact this was not the only thing that was like this. There were a half dozen different places this had occurred. Take the following example:
4096 23 SMB_TYPE_MEMARRAY (type 16) (physical memory array) Location: 3 (system board or motherboard) Use: 3 (system memory) ECC: 6 (multi-bit ECC) Number of Slots/Sockets: 24 Memory Error Data: Not Supported Max Capacity: 3298534883328 bytes ID SIZE TYPE 4352 92 SMB_TYPE_MEMDEVICE (type 17) (memory device) Manufacturer: 00CE00B300CE Serial Number: 32C3433E Asset Tag: 00162630 Location Tag: A1 Part Number: M393A2K43BB1-CRC Physical Memory Array: 4096 Memory Error Data: Not Supported Total Width: 72 bits Data Width: 64 bits Size: 17179869184 bytes Form Factor: 9 (DIMM) Set: 1 Rank: 2 (dual) Memory Type: 26 (DDR4) Flags: 0x2080 SMB_MDF_SYNC (synchronous) SMB_MDF_REG (Registered (Buffered)) Speed: 2400 MT/s Configured Speed: 2400 MT/s Device Locator: A1 Bank Locator: Minimum Voltage: 1.20V Maximum Voltage: 1.20V
See how there are a few entries which are not indented the same as everything else. This is because of the impact of the tabs.
Related issues
Updated by Robert Mustacchi over 4 years ago
- Related to Feature #5094: Update libsmbios with recent items added
Updated by Electric Monk over 4 years ago
- Status changed from New to Closed
git commit e9cac61d8dc1ac02dd8eed83d984709ce38b49f2
commit e9cac61d8dc1ac02dd8eed83d984709ce38b49f2 Author: Robert Mustacchi <rm@joyent.com> Date: 2018-02-13T17:16:23.000Z 9049 smbios(1M) confusingly uses literal tabs in output strings 9050 smbios hex dump isn't aligned for triple digit offsets Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Ryan Zezeski <ryan.zeseski@joyent.com> Reviewed by: Yuri Pankov <yuripv@yuripv.net> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Richard Lowe <richlowe@richlowe.net>