Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error reporting #34

Open
jrgerber opened this issue Apr 27, 2021 · 2 comments
Open

Improve error reporting #34

jrgerber opened this issue Apr 27, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@jrgerber
Copy link
Owner

jrgerber commented Apr 27, 2021

The original dmidecode has error reporting that looks like this:

# dmidecode 3.2
Scanning /dev/mem for entry point.
# No SMBIOS nor DMI entry point found, sorry.

Things of note:

  1. The version is output for all commands, not just in the help
  2. The use of the "#" symbol. What is the logic for when "#" is used?
  3. The failure explanation is nice and verbose

Also investigate and understand what information goes to stdout versus stderr.

@jrgerber jrgerber added the enhancement New feature or request label Apr 27, 2021
@jrgerber
Copy link
Owner Author

jrgerber commented May 1, 2021

Here are some original dmidecode errors:

root@UbuntuRust:~/dmidecode-rs/target/debug# dmidecode --no-sysfs --dev-mem /dev/memx -u|more
/dev/memx: No such file or directory
# dmidecode 3.1
Scanning /dev/memx for entry point.
root@UbuntuRust:~/dmidecode-rs/target/debug# dmidecode --no-sysfs --dev-mem ./dmidecode|more
# dmidecode 3.1
Scanning ./dmidecode for entry point.
# No SMBIOS nor DMI entry point found, sorry.
root@UbuntuRust:~/dmidecode-rs/target/debug# dmidecode --no-sysfs --dev-mem /sys/firmware/dmi/tables/DMI|more
mmap: Can't map beyond end of file /sys/firmware/dmi/tables/DMI
# dmidecode 3.1
Scanning /sys/firmware/dmi/tables/DMI for entry point.

The corresponding errors with Rust dmidecode:

root@UbuntuRust:~/dmidecode-rs/target/debug# ./dmidecode --no-sysfs --dev-mem /dev/memx -u|more
# dmidecode-rs 0.1.0
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
root@UbuntuRust:~/dmidecode-rs/target/debug# ./dmidecode --no-sysfs --dev-mem ./dmidecode|more
# dmidecode-rs 0.1.0
Error: Custom { kind: UnexpectedEof, error: "Not found" }
root@UbuntuRust:~/dmidecode-rs/target/debug# ./dmidecode --no-sysfs --dev-mem /sys/firmware/dmi/tables/DMI|more
Error: # dmidecode-rs 0.1.0
Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" }

The original dmidecode error messages are much more descriptive of what went wrong.

@jrgerber
Copy link
Owner Author

jrgerber commented May 2, 2021

See https://github.com/mirror/dmidecode/blob/master/dmiopt.c for mutually exclusive error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant