Bug#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"
Simon McVittie
smcv at debian.org
Tue Sep 26 19:54:24 BST 2023
On Tue, 26 Sep 2023 at 14:00:39 -0400, Daniel Kahn Gillmor wrote:
> 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 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
More information about the pkg-gnome-maintainers
mailing list