Hi,

here's a smallish patch to silence some annoying warnings i have in my
logs on my mozilla builder at each build, which is running headless and
doesnt have a notification daemon running:

Apr  9 07:07:05 c64 notify-send: vfprintf %s NULL in "Using sever %s %s, v%s - 
Supporting Notification Spec %s"
Apr  9 07:07:05 c64 last message repeated 3 times
Apr  9 07:12:16 c64 notify-send: vfprintf %s NULL in "Using sever %s %s, v%s - 
Supporting Notification Spec %s"
Apr  9 07:12:16 c64 last message repeated 3 times

The mozilla build system does run notify-send (if installed) at various
steps of the build, cf
https://searchfox.org/mozilla-central/source/python/mozbuild/mozbuild/base.py#627

i've had those since a long time, the strange thing is that the printed
message is only a g_debug one and i dont know what would set glib
debugging msgs to be printed within the mozbuild goo, but that can be
reproduced locally with:

(thats on a laptop running xfce)
G_MESSAGES_DEBUG=all  notify-send --app-name="Mozilla Build System" "bla bli 
blu" blah
(notify-send:16579): libnotify-DEBUG: 09:37:00.687: Using sever Xfce Notify 
Daemon Xfce, v0.8.2 - Supporting Notification Spec 1.2

(on my builder i get this)
[09:37] 
c64:/usr/obj/ports/libnotify-0.8.2/libnotify-0.8.2/$G_MESSAGES_DEBUG=all  
notify-send --app-name="Mozilla Build System" "bla bli blu" blah
(notify-send:29048): libnotify-DEBUG: 09:37:28.198: Using sever (null)(null), 
v(null) - Supporting Notification Spec (null)
Impossible de lancer automatiquement D-Bus sans $DISPLAY X11
[09:37] c64:/usr/obj/ports/libnotify-0.8.2/libnotify-0.8.2/ $tail -1 
/var/log/messages
Apr  9 09:37:28 c64 notify-send: vfprintf %s NULL in "Using sever %s %s, v%s - 
Supporting Notification Spec %s"

patch below, better suggestions welcome :)
avoid vfprintf %s NULL in "Using sever %s %s, v%s - Supporting Notification 
Spec %s"
Index: tools/notify-send.c
--- tools/notify-send.c.orig
+++ tools/notify-send.c
@@ -329,8 +329,10 @@ main (int argc, char *argv[])
                                 &server_version,
                                 &server_spec_version);
 
-        g_debug ("Using sever %s %s, v%s - Supporting Notification Spec %s",
-                 server_name, server_vendor, server_version, 
server_spec_version);
+        if (server_name != NULL && server_vendor != NULL &&
+            server_version != NULL && server_spec_version != NULL)
+                g_debug ("Using sever %s %s, v%s - Supporting Notification 
Spec %s",
+                         server_name, server_vendor, server_version, 
server_spec_version);
         g_free (server_name);
         g_free (server_vendor);
         g_free (server_version);

Reply via email to