Hi there,

        Trying to chase down my sudden keyring / tmpfile socket death
syndrome ;-) I poked at the tmpfile cleanup code.

        With this debug patch:

diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 21bf44d..92082e4 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -133,14 +133,19 @@ static void load_unix_sockets(void) {
 
                 truncate_nl(line);
 
+                fprintf (stderr, "line '%s'\n", line);
                 if (strlen(line) < 53)
                         continue;
 
                 p = line + 53;
+                fprintf (stderr, "line[53] '%s'\n", p);
+
                 p += strspn(p, WHITESPACE);
                 p += strcspn(p, WHITESPACE);
                 p += strspn(p, WHITESPACE);
 
+                fprintf (stderr, "line[53] '%s'\n", p);
+
                 if (*p != '/')
                         continue;
 
@@ -149,6 +154,7 @@ static void load_unix_sockets(void) {
 
                 path_kill_slashes(s);
 
+                fprintf (stderr, "set_put '%s'\n", s);
                 if ((k = set_put(unix_sockets, s)) < 0) {
                         free(s);
 
        I got this output:

line 'f2f8b940: 00000002 00000000 00010000 0001 01
42673259 /tmp/.X11-unix/X0'
line[53] ' /tmp/.X11-unix/X0'
line[53] ''
line 'f1b1fdc0: 00000002 00000000 00010000 0001 01
42674940 /tmp/.ICE-unix/9731'
line[53] ' /tmp/.ICE-unix/9731'
line[53] ''
line 'f2f56040: 00000002 00000000 00010000 0001 01
796 /var/run/dbus/system_bus_socket'
line[53] 'ar/run/dbus/system_bus_socket'
line[53] ''
line 'f2f6eb80: 00000002 00000000 00010000 0001 01
42675813 /tmp/keyring-cNhiNs/control'
line[53] ' /tmp/keyring-cNhiNs/control'
line[53] ''
...

        ie. nothing going into the hash; with the attached patch as a fix, and
an additional:

 @@ -149,6 +142,7 @@ static void load_unix_sockets(void) {
 
                 path_kill_slashes(s);
 
+                fprintf (stderr, "set_put '%s'\n", s);
                 if ((k = set_put(unix_sockets, s)) < 0) {
                         free(s);
 
I get:

set_put '/tmp/.X11-unix/X0'
set_put '/tmp/.ICE-unix/9731'
set_put '/var/run/dbus/system_bus_socket'
set_put '/tmp/keyring-cNhiNs/control'
set_put '/tmp/keyring-cNhiNs/ssh'
set_put '/tmp/keyring-cNhiNs/gpg'
set_put '/tmp/keyring-cNhiNs/pkcs11'
set_put '/tmp/.esd-1000/socket'
set_put
'/home/michael/.pulse/e840e2e044504d5071681f0d00000658-runtime/native'
set_put
'/home/michael/.pulse/e840e2e044504d5071681f0d00000658-runtime/dbus-socket'
set_put '/tmp/dbus-QcEdBn2bFr'
set_put '/tmp/gdm-session-WfnKDMpY'
set_put '/tmp/.X11-unix/X0'
set_put '/var/run/acpid.socket'
...

        which I was expecting.

        Hope that's ok: my first prototype systemd patch ;-)

        Could this potentially explain my problem ?

        All the best,

                Michael.


-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot
>From 6b148412543b813dc30c2d778375b41c08e45614 Mon Sep 17 00:00:00 2001
From: Michael Meeks <michael.me...@suse.com>
Date: Wed, 11 Jan 2012 12:31:40 +0000
Subject: [PATCH] simplify and fix /proc/net/unix parsing

---
 src/tmpfiles.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 19a7c08..65da6fb 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -135,15 +135,8 @@ static void load_unix_sockets(void) {
 
                 truncate_nl(line);
 
-                if (strlen(line) < 53)
-                        continue;
-
-                p = line + 53;
-                p += strspn(p, WHITESPACE);
-                p += strcspn(p, WHITESPACE);
-                p += strspn(p, WHITESPACE);
-
-                if (*p != '/')
+                /* the numeric fields are followed by an absolute path beginning with '/' */
+                if (line[0] == '\0' || !(p = strchr (line, '/')))
                         continue;
 
                 if (!(s = strdup(p)))
-- 
1.7.3.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to