#1052992 Glib-GIO warnings from spicy: "GFileInfo created without etag::value" and "gio/gfileinfo.c: line 2085 (g_file_info_get_etag): should not be reached"

Package:
spice-client-gtk
Source:
spice-client-gtk
Description:
Simple clients for interacting with SPICE servers
Submitter:
Daniel Kahn Gillmor
Date:
2023-09-26 18:57:04 UTC
Severity:
normal
#1052992#5
Date:
2023-09-26 18:00:39 UTC
From:
To:
Dear Maintainer,

When i run spicy with the following command:

    spicy --uri=spice+unix:///path/to/spice/socket/S.spice --spice-shared-dir=/path/to/spice/shared

it produces the following GLbwarnings on stderr:

    (spicy:1937777): GLib-GIO-CRITICAL **: 13:28:06.406: GFileInfo created without etag::value

    (spicy:1937777): GLib-GIO-CRITICAL **: 13:28:06.406: file ../../../gio/gfileinfo.c: line 2085 (g_file_info_get_etag): should not be reached

The program still appears to work, so i don't think these warnings are
as "CRITICAL" as they purport to be, but it is probably still worth
looking into it further.

Each time i try to access the shared folder via webdav from within the qemu
guest that is backing this spice session, the same two warnings appear
on stdout, so i assume it's associated with the --spice-shared-dir
option, but i haven't diagnosed it further than that.

#1052992#10
Date:
2023-09-26 18:54:24 UTC
From:
To:
The thing that is now considered to be a programming error by GLib here
is that spicy is calling g_file_info_get_etag() on a GFileInfo without
knowing whether the GFileInfo *has* an etag. The intended pattern is
something like

    if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ETAG_VALUE))
      do_something_with (g_file_info_get_etag (info));
    else
      ... do whatever is appropriate if there is no etag

Older versions of GLib would have silently returned NULL from
g_file_info_get_etag() in this situation, but that made it unclear whether
the result was (meant to be) nullable in non-programming-error scenarios
(and therefore something that should always be runtime NULL-checked), or
whether it was valid to assume that
g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ETAG_VALUE) implied
g_file_info_get_etag (info) != NULL.

In newer GLib, it's diagnosed as a programming error, similar to something
like g_object_ref(NULL).

Environment variable G_DEBUG=fatal-criticals can be used to turn these
warnings into a crash with an assertion failure, if that's useful while
debugging.

    smcv