]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "logind: always enclose list fields (that may contain spaces) in quotes"
authorLuca Boccassi <luca.boccassi@gmail.com>
Wed, 21 May 2025 23:56:18 +0000 (00:56 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 22 May 2025 09:00:52 +0000 (10:00 +0100)
This breaks GNOME on Wayland, login no longer works:

gnome-shell[2250]: Running GNOME Shell (using mutter 48.2) as a Wayland display server
gnome-shell[2250]: Failed to setup: Failed to find any matching session
systemd[2054]: org.gnome.Shell@wayland.service: Failed with result 'protocol'.
systemd[2054]: Failed to start org.gnome.Shell@wayland.service - GNOME Shell on Wayland.

This reverts commit b0555149de780f81ec6f741d36bdb41b4d1d8a94.

src/login/logind-seat.c
src/login/logind-session.c
src/login/logind-user.c

index 1b6b1aa475d53bfe2404fa5bfb5c8b94fdbe7695..84a6264fe6d61ee93709229a24579d93d6d863a8 100644 (file)
@@ -131,19 +131,20 @@ int seat_save(Seat *s) {
         }
 
         if (s->sessions) {
-                fputs("SESSIONS=\"", f);
-                LIST_FOREACH(sessions_by_seat, i, s->sessions)
+                fputs("SESSIONS=", f);
+                LIST_FOREACH(sessions_by_seat, i, s->sessions) {
                         fprintf(f,
-                                "%s%s",
+                                "%s%c",
                                 i->id,
-                                i->sessions_by_seat_next ? " " : "\"\n");
+                                i->sessions_by_seat_next ? ' ' : '\n');
+                }
 
-                fputs("UIDS=\"", f);
+                fputs("UIDS=", f);
                 LIST_FOREACH(sessions_by_seat, i, s->sessions)
                         fprintf(f,
-                                UID_FMT"%s",
+                                UID_FMT"%c",
                                 i->user->user_record->uid,
-                                i->sessions_by_seat_next ? " " : "\"\n");
+                                i->sessions_by_seat_next ? ' ' : '\n');
         }
 
         r = flink_tmpfile(f, temp_path, s->state_file, LINK_TMPFILE_REPLACE);
index ad7391effb67bdf67d2948f0619863b17ebe61c9..9311d918faefe7d7cd93fb4bc36acb2af946dbab 100644 (file)
@@ -270,19 +270,12 @@ int session_set_leader_consume(Session *s, PidRef _leader) {
 static void session_save_devices(Session *s, FILE *f) {
         SessionDevice *sd;
 
-        if (hashmap_isempty(s->devices))
-                return;
-
-        bool need_space = false;
-        fputs("DEVICES=\"", f);
-        HASHMAP_FOREACH(sd, s->devices) {
-                if (need_space)
-                        fputc(' ', f);
-
-                fprintf(f, DEVNUM_FORMAT_STR, DEVNUM_FORMAT_VAL(sd->dev));
-                need_space = true;
+        if (!hashmap_isempty(s->devices)) {
+                fprintf(f, "DEVICES=");
+                HASHMAP_FOREACH(sd, s->devices)
+                        fprintf(f, DEVNUM_FORMAT_STR " ", DEVNUM_FORMAT_VAL(sd->dev));
+                fprintf(f, "\n");
         }
-        fputs("\"\n", f);
 }
 
 int session_save(Session *s) {
index 19eda779338f8b4777300a07509cfa6740cf1c49..2005a4da18912e365152163992327a93e476398e 100644 (file)
@@ -195,7 +195,7 @@ static int user_save_internal(User *u) {
         if (u->sessions) {
                 bool first;
 
-                fputs("SESSIONS=\"", f);
+                fputs("SESSIONS=", f);
                 first = true;
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
                         if (first)
@@ -206,8 +206,7 @@ static int user_save_internal(User *u) {
                         fputs(i->id, f);
                 }
 
-                fputs("\"\n"
-                      "SEATS=\"", f);
+                fputs("\nSEATS=", f);
                 first = true;
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
                         if (!i->seat)
@@ -221,8 +220,7 @@ static int user_save_internal(User *u) {
                         fputs(i->seat->id, f);
                 }
 
-                fputs("\"\n"
-                      "ACTIVE_SESSIONS=\"", f);
+                fputs("\nACTIVE_SESSIONS=", f);
                 first = true;
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
                         if (!session_is_active(i))
@@ -236,8 +234,7 @@ static int user_save_internal(User *u) {
                         fputs(i->id, f);
                 }
 
-                fputs("\"\n"
-                      "ONLINE_SESSIONS=\"", f);
+                fputs("\nONLINE_SESSIONS=", f);
                 first = true;
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
                         if (session_get_state(i) == SESSION_CLOSING)
@@ -251,8 +248,7 @@ static int user_save_internal(User *u) {
                         fputs(i->id, f);
                 }
 
-                fputs("\"\n"
-                      "ACTIVE_SEATS=\"", f);
+                fputs("\nACTIVE_SEATS=", f);
                 first = true;
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
                         if (!session_is_active(i) || !i->seat)
@@ -266,8 +262,7 @@ static int user_save_internal(User *u) {
                         fputs(i->seat->id, f);
                 }
 
-                fputs("\"\n"
-                      "ONLINE_SEATS=\"", f);
+                fputs("\nONLINE_SEATS=", f);
                 first = true;
                 LIST_FOREACH(sessions_by_user, i, u->sessions) {
                         if (session_get_state(i) == SESSION_CLOSING || !i->seat)
@@ -280,7 +275,7 @@ static int user_save_internal(User *u) {
 
                         fputs(i->seat->id, f);
                 }
-                fputs("\"\n", f);
+                fputc('\n', f);
         }
 
         r = flink_tmpfile(f, temp_path, u->state_file, LINK_TMPFILE_REPLACE);