unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "Gábor Boskovits" <boskovits@gmail.com>
Cc: 37423@debbugs.gnu.org
Subject: bug#37423: Changing the login service from GDM to SLiM and then back to GDM causes a really bad loop
Date: Fri, 20 Sep 2019 11:40:43 +0200	[thread overview]
Message-ID: <875zlntiec.fsf@gnu.org> (raw)
In-Reply-To: <CAE4v=piYh_FZSwE=LLsYRd=v655cimiGpVYoegkDNJ29RzGi_w@mail.gmail.com> ("Gábor Boskovits"'s message of "Thu, 19 Sep 2019 23:47:58 +0200")

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Hi Gábor,

Gábor Boskovits <boskovits@gmail.com> skribis:

> Couldn't we simply do what the fix does: ensuring the owner of
> the files under “/var/lib/gdm” is the current “gdm” user?

Hey you’re right, I was not approaching it from the right angle.

Here’s a patch that does that.  Thoughts?

I’ll push it if there are no objections.

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1856 bytes --]

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 06d72b5f60..1d55e388a1 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -773,6 +773,27 @@ the GNOME desktop environment.")
          (home-directory "/var/lib/gdm")
          (shell (file-append shadow "/sbin/nologin")))))
 
+(define %gdm-activation
+  ;; Ensure /var/lib/gdm is owned by the "gdm" user.  This is normally the
+  ;; case but could be wrong if the "gdm" user was created, then removed, and
+  ;; then recreated under a different UID/GID: <https://bugs.gnu.org/37423>.
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (let* ((gdm (getpwnam "gdm"))
+               (uid (passwd:uid gdm))
+               (gid (passwd:gid gdm))
+               (st  (stat "/var/lib/gdm" #f)))
+          ;; Recurse into /var/lib/gdm only if it has wrong ownership.
+          (when (and st
+                     (or (not (= uid (stat:uid st)))
+                         (not (= gid (stat:gid st)))))
+            (for-each (lambda (file)
+                        (chown file uid gid))
+                      (find-files "/var/lib/gdm"
+                                  #:directories? #t)))))))
+
 (define dbus-daemon-wrapper
   (program-file
    "gdm-dbus-wrapper"
@@ -915,6 +936,8 @@ the GNOME desktop environment.")
                 (extensions
                  (list (service-extension shepherd-root-service-type
                                           gdm-shepherd-service)
+                       (service-extension activation-service-type
+                                          (const %gdm-activation))
                        (service-extension account-service-type
                                           (const %gdm-accounts))
                        (service-extension pam-root-service-type

  reply	other threads:[~2019-09-20  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-15 22:51 bug#37423: Changing the login service from GDM to SLiM and then back to GDM causes a really bad loop Jan
2019-09-17  4:45 ` Timothy Sample
2019-09-17 11:16   ` Jan
2019-09-19 21:22   ` Ludovic Courtès
2019-09-19 21:47     ` Gábor Boskovits
2019-09-20  9:40       ` Ludovic Courtès [this message]
2019-09-20 11:03         ` Julien Lepiller
2019-09-20 13:25         ` Timothy Sample
2019-09-20 21:10           ` Ludovic Courtès
2019-09-19 22:00     ` Tobias Geerinckx-Rice via Bug reports for GNU Guix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zlntiec.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=37423@debbugs.gnu.org \
    --cc=boskovits@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).