https://bugs.kde.org/show_bug.cgi?id=466318

            Bug ID: 466318
           Summary: fwupd backend errors on startup with fwupd 1.8.11:
                    "user agent unset"
    Classification: Applications
           Product: Discover
           Version: 5.27.1
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: fwupd Backend
          Assignee: plasma-b...@kde.org
          Reporter: ad...@happyassassin.net
                CC: aleix...@kde.org, sharma.abhijeet2...@gmail.com
  Target Milestone: ---

SUMMARY

With fwupd 1.8.11 (recently released), Discover with the fwupd backend shows an
error on startup: "user agent unset". I don't know yet whether this prevents
use of Discover entirely (it was caught by an automated test system which isn't
smart enough to try closing the dialog and continuing), but I'm pretty sure it
at least will render the fwupd backend non-functional.

STEPS TO REPRODUCE
1. Run Discover with the fwupd backend enabled and fwupd 1.8.11 installed (e.g.
on current Fedora Rawhide)

OBSERVED RESULT
Error is shown.

EXPECTED RESULT
No error.

SOFTWARE/OS VERSIONS
Plasma 5.27.1 on Fedora Rawhide (39).

ADDITIONAL INFORMATION
I've root caused this (I think) in the downstream bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2173022 . The change that triggered
this is a check in `fwupd_client_set_user_agent_for_package` that was added in
fwupd 1.8.11: it now bails out if priv->daemon_version is not set. See
https://github.com/fwupd/fwupd/commit/34743ff6f48510839ca3ef5f4ad6fe51ffd3425c
. This check was added for a good reason: priv->daemon_version is used in
constructing the user agent string, so if it's not set, you get "NULL" in the
second part of the string, which is bad and apparently confused LVFS.

Discover calls `fwupd_client_set_user_agent_for_package` as just about the
first thing it does after creating the client instance. This apparently is too
early, nothing has set the daemon version yet. gnome-software, as best as I can
tell, waits until it has done `fwupd_client_connect_async` and
`fwupd_client_set_feature_flags_async` (and the corresponding `finish` calls)
before it does `fwupd_client_set_user_agent_for_package`, with an explicit
comment that "/* we know the runtime daemon version now */". So it's
intentionally doing the user agent after those two other things with the intent
that one of them causes the daemon version to be set. See
https://gitlab.gnome.org/GNOME/gnome-software/-/blob/main/plugins/fwupd/gs-plugin-fwupd.c#L285-286
and the blocks around there.

Logically speaking, I guess this means Discover should do something similar: do
client_connect and/or set_feature_flags before it does
set_user_agent_for_package. I'm trying to write a patch to do that, but I am no
kind of C coder so I may fail miserably, so I figured I'd file a bug so better
C coders can look at it. :D

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to