[bug#70318] Fix unitentional creation of greeter's home directory

Message ID c45600de103d560b3487772b103d7e4b@disroot.org
State New
Headers
Series [bug#70318] Fix unitentional creation of greeter's home directory |

Commit Message

tusharhero--- via Guix-patches via April 9, 2024, 11:58 p.m. UTC
This patch adresses the unintentional creation of the greeter's home 
directory when using the greetd-service.
  

Comments

muradm Jan. 3, 2025, 6:05 p.m. UTC | #1
This may break greeters which are more complex than agreety. For 
instance, gtkgreet/wlgreet run under sway. One of subdependencies 
is mesa, which will want to write shader caches somewhere. Another 
one is fontconfig, doing similar thing for fonts. There may be 
others, which hard to track and tune. Some could be impossible to 
tune at all.

lgcoelho@disroot.org writes:

> This patch adresses the unintentional creation of the greeter's 
> home
> directory when using the greetd-service.
>
> [4. text/x-diff; 
> 0001-services-base-Fix-unintentional-creation-of-greeter-.patch]...
  
Nicolas Graves Jan. 4, 2025, 2:06 p.m. UTC | #2
On 2025-01-03 21:05, muradm wrote:

> This may break greeters which are more complex than agreety. For 
> instance, gtkgreet/wlgreet run under sway. One of subdependencies 
> is mesa, which will want to write shader caches somewhere. Another 
> one is fontconfig, doing similar thing for fonts. There may be 
> others, which hard to track and tune. Some could be impossible to 
> tune at all.

Then maybe we can make it conditional on agreety?

If all greetd-configuration-terminals have their
greet-default-session-command being an greetd-agreety-session?, we could
set it to #f.

Something like this could work: 
(create-home-directory? (not (every greetd-agreety-session? (map greetd-default-session-command (greetd-configuration-terminals config)))))

WDYT?
  
muradm Jan. 4, 2025, 3:05 p.m. UTC | #3
Nicolas Graves <ngraves@ngraves.fr> writes:

> On 2025-01-03 21:05, muradm wrote:
>
>> This may break greeters which are more complex than agreety. 
>> For
>> instance, gtkgreet/wlgreet run under sway. One of 
>> subdependencies
>> is mesa, which will want to write shader caches somewhere. 
>> Another
>> one is fontconfig, doing similar thing for fonts. There may be
>> others, which hard to track and tune. Some could be impossible 
>> to
>> tune at all.
>
> Then maybe we can make it conditional on agreety?
>
> If all greetd-configuration-terminals have their
> greet-default-session-command being an greetd-agreety-session?, 
> we could
> set it to #f.
>
> Something like this could work:
> (create-home-directory? (not (every greetd-agreety-session? (map 
> greetd-default-session-command (greetd-configuration-terminals 
> config)))))
>
> WDYT?

2 of 3 greeters needs home. With improvements implemented by 75270 
`greetd-terminal-configuration` is detached from details of its 
`default-session-command`. By this, any user can workout its 
greeter. If we hardcode implementation of greeter in terminal user 
may loose such flexibility. Also once you implement such 
condition, you will have to maintain with any other greeter added 
in the future.

One way would be to carry this flag into `greetd-configuration`, 
IMHO will uneccessarily complicate the things. Is there any good 
reason for doing that?

What is the problem with having home directory for greeter user?
  
muradm Jan. 4, 2025, 5:08 p.m. UTC | #4
muradm <mail@muradm.net> writes:

>>
>> Then maybe we can make it conditional on agreety?
>>
>> If all greetd-configuration-terminals have their
>> greet-default-session-command being an greetd-agreety-session?, 
>> we
>> could
>> set it to #f.
>>
>> Something like this could work:
>> (create-home-directory? (not (every greetd-agreety-session? 
>> (map
>> greetd-default-session-command (greetd-configuration-terminals
>> config)))))
>>
>> WDYT?
>
> 2 of 3 greeters needs home. With improvements implemented by 
> 75270
> `greetd-terminal-configuration` is detached from details of its
> `default-session-command`. By this, any user can workout its 
> greeter.
> If we hardcode implementation of greeter in terminal user may 
> loose
> such flexibility. Also once you implement such condition, you 
> will
> have to maintain with any other greeter added in the future.
>
> One way would be to carry this flag into `greetd-configuration`, 
> IMHO
> will uneccessarily complicate the things. Is there any good 
> reason for
> doing that?
>
> What is the problem with having home directory for greeter user?

After some more meditation, I remembered that originally I also 
did not like idea of having extra user home directory and 
considering changes introduced by #75270, it became obvious that 
sway specific environment can be setup within 
`make-greetd-sway-greeter-command`. Further greeters may either 
improve on it, or provide their own entry point commands as they 
see fit. v2 of 75270 includes this change, and adjusts the 
environment accordingly. This issue can be closed in favor if 
75270.
  

Patch

From 4be55c2b63c050ae837e9afa7969cfb3ee8df1e5 Mon Sep 17 00:00:00 2001
From: Luis Guilherme Coelho <lgcoelho@disroot.org>
Date: Tue, 9 Apr 2024 20:38:33 -0300
Subject: [PATCH] services: base: Fix unintentional creation of greeter's home
 directory

* gnu/services/base.scm (greetd-account) [create-home-directory?]: Set to false.
---
 gnu/services/base.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3f912225a0..b39b8418ed 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -21,6 +21,7 @@ 
 ;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
 ;;; Copyright © 2022 ( <paren@disroot.org>
 ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
+;;; Copyright © 2024 Luis Guilherme Coelho <lgcoelho@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3481,6 +3482,7 @@  (define (greetd-accounts config)
          (name "greeter")
          (group "greeter")
          (supplementary-groups (greetd-greeter-supplementary-groups config))
+         (create-home-directory? #f)
          (system? #t))))
 
 (define (make-greetd-pam-mount-conf-file config)
-- 
2.41.0