[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#988589: marked as done (cdebconf-gtk: should capture GLib structured logging to syslog in d-i)

Your message dated Thu, 20 May 2021 05:33:25 +0000
with message-id <E1ljbJF-0007NA-De@fasolo.debian.org>
and subject line Bug#988589: fixed in cdebconf 0.258
has caused the Debian Bug report #988589,
regarding cdebconf-gtk: should capture GLib structured logging to syslog in d-i
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org

988589: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988589
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: cdebconf-gtk
Version: 0.257
Severity: normal
Tags: patch d-i

If a library like Pango is using the structured logging API in GLib 2.50+,
its logging messages are not caught by cdebconf-gtk's log handler.

Patch attached, also available at

>From f66ecc20da5f265cecf361f6983d92670a723bf8 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Sun, 16 May 2021 13:04:08 +0100
Subject: [PATCH] gtk: Capture new-style GLib structured logging messages under

GLib 2.50 replaced the non-machine-readable, text-based logging that
uses g_log_set_default_handler() with a more structured logging
framework inspired by systemd-journal. Each library can either use the
structured or unstructured logging framework; unstructured messages are
received by structured log handlers, but the opposite is not true.

For the purposes of this debconf frontend, the interesting libraries
include GLib and Pango (which use structured logging) and GTK 2
(which does not). As a result, GLib and Pango debug messages did not
go to the syslog in d-i; now they do.

Signed-off-by: Simon McVittie <smcv@debian.org>
 debian/control                |  2 +-
 src/modules/frontend/gtk/di.c | 36 ++++++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index f9c59227..caf9ead8 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Build-Depends:
  libtextwrap-dev (>= 0.1-5),
  libdebian-installer4-dev (>= 0.41) | libdebian-installer-dev,
- libglib2.0-dev (>= 2.31),
+ libglib2.0-dev (>= 2.50),
  libgtk2.0-dev (>= 2.24) <!pkg.cdebconf.nogtk>,
  libcairo2-dev (>= 1.8.10-3) <!pkg.cdebconf.nogtk>,
  libselinux1-dev (>= 2.3) [linux-any] | libselinux-dev [linux-any],
diff --git a/src/modules/frontend/gtk/di.c b/src/modules/frontend/gtk/di.c
index 3dc5d38c..a6cb38f1 100644
--- a/src/modules/frontend/gtk/di.c
+++ b/src/modules/frontend/gtk/di.c
@@ -142,6 +142,40 @@ static void log_glib_to_syslog(const gchar * log_domain,
+/** Implementation of GLogFunc for the GTK+ frontend.
+ *
+ * This will log messages going through the glib log system to the standard
+ * syslog.
+ *
+ * @param log_domain the log domain of the message
+ * @param log_level the log level of the message
+ * @param message the message to process
+ * @param user_data user data, set in g_log_set_handler()
+ */
+static GLogWriterOutput log_glib_structured_to_syslog(GLogLevelFlags log_level,
+                                                      const GLogField *fields,
+                                                      gsize n_fields,
+                                                      gpointer user_data)
+    const char *domain = NULL;
+    const char *message = "(no message)";
+    gsize i;
+    for (i = 0; i < n_fields; i++) {
+          const GLogField *field = &fields[i];
+          if (g_strcmp0(field->key, "MESSAGE") == 0) {
+              message = field->value;
+          }
+          else if (g_strcmp0(field->key, "GLIB_DOMAIN") == 0) {
+              domain = field->value;
+          }
+    }
+    log_glib_to_syslog(domain, log_level, message, NULL);
 /** Make the given window fullscreen.
  * @param window main window
@@ -287,7 +321,7 @@ gboolean cdebconf_gtk_di_setup(struct frontend * fe)
     fe_data->di_data = di_data;
     (void) g_set_printerr_handler(print_to_syslog);
-    (void) g_log_set_default_handler(log_glib_to_syslog,  NULL);
+    g_log_set_writer_func(log_glib_structured_to_syslog, NULL, NULL);

--- End Message ---
--- Begin Message ---
Source: cdebconf
Source-Version: 0.258
Done: Cyril Brulebois <kibi@debian.org>

We believe that the bug you reported is fixed in the latest version of
cdebconf, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 988589@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
Cyril Brulebois <kibi@debian.org> (supplier of updated cdebconf package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)

Hash: SHA512

Format: 1.8
Date: Thu, 20 May 2021 06:56:57 +0200
Source: cdebconf
Architecture: source
Version: 0.258
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Cyril Brulebois <kibi@debian.org>
Closes: 882804 987377 987449 988589 988787
 cdebconf (0.258) unstable; urgency=medium
   [ Simon McVittie ]
   * Capture new-style GLib structured logging messages, ensuring that we
     stop losing messages generated by libraries using that structured
     logging (ie. GLib and Pango) instead of the old text-based logging
     (i.e. GTK 2) (Closes: #988589).
   * Postpone adding text to GtkTextView until GTK has done initial layout,
     to avoid running into an infinite loop that would result in only the
     title being displayed, and a hang of the installer (Closes: #988787).
     This fixes a number of scenarios including:
     - Hang before offering a shell in rescue mode [en] (Closes: #987377).
     - Hang immediately with Sinhala and other languages (Closes: #987449).
     - Hang in various places with Swedish (mirror selection or package
       manager configuration).
   [ Cyril Brulebois ]
   * Huge thanks to Simon McVittie for the incredible support!
   * Align the display of info messages (e.g. “Rescue mode”) to the right
     again, since Debian (logo and name) is back on the left side with the
     Homeworld theme.
   * Implement workaround to ensure info messages (e.g. “Rescue mode”) get
     displayed on the banner on the start-up screen (Closes: #882804).
   [ Updated translations ]
   * Japanese (ja.po) by Nozomu KURASAWA
 c202a05e3e2c0f5babc2e11a8d953e6358dd6c84 2746 cdebconf_0.258.dsc
 5e3640a8178fa151d04c577c9afe6de276d2fcab 279820 cdebconf_0.258.tar.xz
 1f86377d391497b8d458d4de5a486101cbd08fb8 11485 cdebconf_0.258_source.buildinfo
 34fec3bad00287e5817cfce98549712d089d1b72453af90b8f3b565549072238 2746 cdebconf_0.258.dsc
 8a59fcb67c9c2ddc1f4b2e26263cbe0f38d5d42343f66ed0583d0be72d56e3f1 279820 cdebconf_0.258.tar.xz
 e282cec4ff0d1a563b974d59bd3fe36a67fb0f83572562ce13573b557a8cd5ac 11485 cdebconf_0.258_source.buildinfo
 79632efeb618e6431f8b2ff499f2bde5 2746 utils optional cdebconf_0.258.dsc
 70fa1fbff4c543bcca420069f0fc7d8d 279820 utils optional cdebconf_0.258.tar.xz
 4ed6f4546d8389c3faafaa95f009ec37 11485 utils optional cdebconf_0.258_source.buildinfo



--- End Message ---

Reply to: