Skip to content

Conversation

@banditopazzo
Copy link
Contributor

Fix #48

Looking at dmidecode utility apparently as of version 2.6 of the SMBIOS specification, the first 3 fields of the UUID are supposed to be encoded on little-endian. The dmidecode utility does not swap bytes for smbios < 2.6 and I think we should be consistent with it.

I think this is a very obscure thing and we should completely hide this complexity to the users of the library returning an already parsed Uuid type in the specific format. This will avoid any doubt to anyone including smbios gurus.

Regarding the implementation I created a private transparent new type wrapper to use instead of plain [u8; 16]. And then the wrapper decodes the uuid field using the smbios version.
It leverage the type system to safely handle the conversion even for potential new smbios revisions with other fields and the compiler inlines the specific implementation in the top level branch skipping the second version compare.
This is the best solution I had to avoid any future errors and with zero cost abstraction.

@banditopazzo banditopazzo force-pushed the fix-system-uuid-smbios-2_6 branch 2 times, most recently from 2c22ae4 to b624738 Compare June 20, 2025 11:15
@banditopazzo banditopazzo force-pushed the fix-system-uuid-smbios-2_6 branch from b624738 to 27034c2 Compare June 20, 2025 11:26
@jcreekmore jcreekmore merged commit bdee9bf into jcreekmore:master Jun 30, 2025
1 check passed
@banditopazzo banditopazzo deleted the fix-system-uuid-smbios-2_6 branch August 5, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SystemInformation uuid field different from dmidecode command

2 participants