[systemd-devel] PATCH: tmpfiles cleanup

Michael Meeks michael.meeks at suse.com
Wed Jan 11 04:38:58 PST 2012


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.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot


More information about the systemd-devel mailing list