우분투 20.04는 GCC 9.x 버전이 설치되며, glib 빌드하면 아래와 같은 에러가 발생한다.
| ../../glib-2.48.2/gio/gdbusmessage.c: In function ‘g_dbus_message_to_blob’:
| ../../glib-2.48.2/gio/gdbusmessage.c:2698:30: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
| 2698 | tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1: some warnings being treated as errors
| make[4]: *** [Makefile:3770: libgio_2_0_la-gdbusmessage.lo] Error 1
같은 이유로 gdbusauth.c에서도 에러가 발생하며, 아래의 패치를 적용하면 쉽게 해결할 수 있다.
diff -Nura glib-2.48.2_old/gio/gdbusauth.c glib-2.48.2_new/gio/gdbusauth.c
--- glib-2.48.2_old/gio/gdbusauth.c 2016-08-18 01:07:40.000000000 +0900
+++ glib-2.48.2_new/gio/gdbusauth.c 2020-11-02 16:29:16.061365617 +0900
@@ -1295,9 +1295,10 @@
&line_length,
cancellable,
error);
- debug_print ("SERVER: WaitingForBegin, read '%s'", line);
if (line == NULL)
goto out;
+
+ debug_print ("SERVER: WaitingForBegin, read '%s'", line);
if (g_strcmp0 (line, "BEGIN") == 0)
{
/* YAY, done! */
diff -Nura glib-2.48.2_old/gio/gdbusmessage.c glib-2.48.2_new/gio/gdbusmessage.c
--- glib-2.48.2_old/gio/gdbusmessage.c 2016-08-18 00:20:47.000000000 +0900
+++ glib-2.48.2_new/gio/gdbusmessage.c 2020-11-02 16:30:52.318735365 +0900
@@ -2695,7 +2695,6 @@
if (message->body != NULL)
{
gchar *tupled_signature_str;
- tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
if (signature == NULL)
{
g_set_error (error,
@@ -2703,10 +2702,10 @@
G_IO_ERROR_INVALID_ARGUMENT,
_("Message body has signature '%s' but there is no signature header"),
signature_str);
- g_free (tupled_signature_str);
goto out;
}
- else if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
+ tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
+ if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
{
g_set_error (error,
G_IO_ERROR,