From a56b5b2d36ec984f6025959c4ca17f9ffaabc42b Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 29 Aug 2022 12:22:50 -0500 Subject: [PATCH] trivial: in the not enough information case show an URL --- docs/hsi.md | 10 ++++++++++ src/fu-tool.c | 14 +++++++++----- src/fu-util.c | 14 +++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/docs/hsi.md b/docs/hsi.md index aa3bd8be2..e097f5dd1 100644 --- a/docs/hsi.md +++ b/docs/hsi.md @@ -140,6 +140,16 @@ A safe baseline for security should be HSI-1. If your system isn't at least meet The command line tool `fwupdmgr security` included with fwupd 1.8.4 or later will make individual recommendations on what you can do for individual test failures. GUI tools built against `libfwupd` 1.8.4 or later may also make these recommendation as well. + + +## [Not enough information](#not-enough-info) + +HSI calculations require that the SOC, firmware, and kernel provide enough data to the fwupd daemon about the state of the system. If any HSI test that runs on the system declares it's *missing data* then the client will show a message like this: + +**Not enough data was provided to make an HSI calculation.** + +The HSI level will also be set to `INVALID` indicating this. + ## [Tests included in fwupd](#tests) diff --git a/src/fu-tool.c b/src/fu-tool.c index bac3952c1..bfda932b6 100644 --- a/src/fu-tool.c +++ b/src/fu-tool.c @@ -2927,16 +2927,20 @@ fu_util_security(FuUtilPrivate *priv, gchar **values, GError **error) items = fu_security_attrs_get_all(attrs); for (guint j = 0; j < items->len; j++) { FwupdSecurityAttr *attr = g_ptr_array_index(items, j); + g_autofree gchar *err_str = NULL; if (!fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA)) continue; if (priv->flags & FWUPD_INSTALL_FLAG_FORCE) continue; - g_set_error_literal(error, - FWUPD_ERROR, - FWUPD_ERROR_NOT_SUPPORTED, - "Not enough data was provided to make an HSI calculation. " - "To ignore this warning, use --force."); + err_str = g_strdup_printf( + "\n%s\n » %s\n%s", + /* TRANSLATORS: error message to tell someone they can't use this feature */ + _("Not enough data was provided to make an HSI calculation."), + "https://fwupd.github.io/hsi.html#not-enough-info", + /* TRANSLATORS: message to tell someone how to ignore error */ + _("To ignore this warning, use --force")); + g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, err_str); return FALSE; } diff --git a/src/fu-util.c b/src/fu-util.c index 67243901c..52726bff2 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -3456,16 +3456,20 @@ fu_util_security(FuUtilPrivate *priv, gchar **values, GError **error) for (guint j = 0; j < attrs->len; j++) { FwupdSecurityAttr *attr = g_ptr_array_index(attrs, j); + g_autofree gchar *err_str = NULL; if (!fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA)) continue; if (priv->flags & FWUPD_INSTALL_FLAG_FORCE) continue; - g_set_error_literal(error, - FWUPD_ERROR, - FWUPD_ERROR_NOT_SUPPORTED, - "Not enough data was provided to make an HSI calculation. " - "To ignore this warning, use --force"); + err_str = g_strdup_printf( + "\n%s\n » %s\n%s", + /* TRANSLATORS: error message to tell someone they can't use this feature */ + _("Not enough data was provided to make an HSI calculation."), + "https://fwupd.github.io/hsi.html#not-enough-info", + /* TRANSLATORS: message to tell someone how to ignore error */ + _("To ignore this warning, use --force")); + g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, err_str); return FALSE; }