GNU bug report logs - #76286
[PATCH] services: greetd: Use user default login shell.

Previous Next

Package: guix-patches;

Reported by: Murilo <murilo <at> disroot.org>

Date: Fri, 14 Feb 2025 11:50:02 UTC

Severity: normal

Tags: patch

Done: "Murilo" <murilo <at> disroot.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76286 in the body.
You can then email your comments to 76286 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#76286; Package guix-patches. (Fri, 14 Feb 2025 11:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Murilo <murilo <at> disroot.org>:
New bug report received and forwarded. Copy sent to ludo <at> gnu.org, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org. (Fri, 14 Feb 2025 11:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Murilo <murilo <at> disroot.org>
To: guix-patches <at> gnu.org
Cc: Murilo <murilo <at> disroot.org>
Subject: [PATCH] services: greetd: Use user default login shell.
Date: Fri, 14 Feb 2025 08:40:46 -0300
* gnu/services/base.scm (<greetd-user-session>)[command]: Use user's
expected login shell.
* doc/guix.texi (Base Services): Change default value for
'greetd-user-session-command' to reflect the newer default command.

Change-Id: Iae702312000d5bc3cc16d40af205ee2c1e5bc4be
---

This patch changes 'greetd-user-session-command' to use the user's actual login
shell by default, rather than bash.

 doc/guix.texi         | 5 +++--
 gnu/services/base.scm | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bd66adf326..ab1598e181 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20630,8 +20630,9 @@ Base Services
 of Bash.
 
 @table @asis
-@item @code{command} (default: @code{(file-append bash "/bin/bash")})
-Command to be started by @command{agreety} on successful login.
+@item @code{command} (default: @code{#~(passwd:shell (getpwnam (getenv "USER")))})
+Command to be started by @command{agreety} on successful login. Defaults to the
+user login shell.
 
 @item @code{command-args} (default: @code{'("-l")})
 Command arguments to pass to command.
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 4bc0433def..848b1bd276 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -3398,7 +3398,8 @@ (define %qemu-static-networking
 
 (define-record-type* <greetd-user-session>
   greetd-user-session make-greetd-user-session greetd-user-session?
-  (command greetd-user-session-command (default (file-append bash "/bin/bash")))
+  (command greetd-user-session-command
+           (default #~(passwd:shell (getpwnam (getenv "USER")))))
   (command-args greetd-user-session-command-args (default '("-l")))
   (extra-env greetd-user-session-extra-env (default '()))
   (xdg-session-type greetd-user-session-xdg-session-type (default "tty"))

base-commit: 3a916935311568b742d734cf76be8a45737f9382
-- 
2.48.1





Information forwarded to guix-patches <at> gnu.org:
bug#76286; Package guix-patches. (Fri, 21 Feb 2025 14:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 76286 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Murilo <murilo <at> disroot.org>
Cc: 76286 <at> debbugs.gnu.org, muradm <mail <at> muradm.net>,
 Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#76286] [PATCH] services: greetd: Use user default login
 shell.
Date: Fri, 21 Feb 2025 23:11:12 +0900
Hi!

Murilo <murilo <at> disroot.org> writes:

> * gnu/services/base.scm (<greetd-user-session>)[command]: Use user's
> expected login shell.
> * doc/guix.texi (Base Services): Change default value for
> 'greetd-user-session-command' to reflect the newer default command.
>
> Change-Id: Iae702312000d5bc3cc16d40af205ee2c1e5bc4be

LGTM.  CC'ìng muradm, just to be sure.  They worked on the recent greetd
changes.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

-- 
Thanks,
Maxim




Information forwarded to guix-patches <at> gnu.org:
bug#76286; Package guix-patches. (Fri, 21 Feb 2025 17:43:04 GMT) Full text and rfc822 format available.

Message #11 received at 76286 <at> debbugs.gnu.org (full text, mbox):

From: muradm <mail <at> muradm.net>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, Murilo <murilo <at> disroot.org>
Cc: 76286 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#76286] [PATCH] services: greetd: Use user default login
 shell.
Date: Fri, 21 Feb 2025 20:42:11 +0300
[Message part 1 (text/plain, inline)]
Hi!

Techincally looks fine, however...

Initially, I intentionally didn't go with login shell. The problem 
is, you can't write 'bash -l` in passwd database.
Having shell command configured in passwd, and its arguments in 
guix configuration may intiated unwanted inconsistency.
For instance, user puts some fancy command as shell in passwd, and 
greetd sticks '-l' flag to it that nukes the hard drive - 
exaggeration to illustrate the problem :)
Personally, I didn't feel comfortable in spreading configuration 
of one command in two unrelated places.

As far as I understand, whoever uses shell configured in passwd 
should known how to invoke it.

However, for instance, in my passwd shell is 
'/gnu/store/cdwviyfnsfv7k57qrwmym0mrynjixc1i-bash-5.1.16/bin/bash', 
if I would not use 'greetd' who would run 'bash -l'?

With Guix, this situation can be handled purely with passwd 
(either command if no args needed or command-with-args wrapping 
script), then for the sake of consistency I would deprecate 
'command' and 'command-args' and rely on passwd only.

Otherwise, I'm afraid that adding complexity in 
'greetd-user-session-command' program to match known shell 
commands, and probably warning/failing for unknown ones will be 
necessary. IMHO.


Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> Hi!
>
> Murilo <murilo <at> disroot.org> writes:
>
>> * gnu/services/base.scm (<greetd-user-session>)[command]: Use 
>> user's
>> expected login shell.
>> * doc/guix.texi (Base Services): Change default value for
>> 'greetd-user-session-command' to reflect the newer default 
>> command.
>>
>> Change-Id: Iae702312000d5bc3cc16d40af205ee2c1e5bc4be
>
> LGTM.  CC'ìng muradm, just to be sure.  They worked on the 
> recent greetd
> changes.
>
> Reviewed-by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#76286; Package guix-patches. (Sat, 22 Feb 2025 13:14:02 GMT) Full text and rfc822 format available.

Message #14 received at 76286 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: muradm <mail <at> muradm.net>
Cc: Murilo <murilo <at> disroot.org>, 76286 <at> debbugs.gnu.org,
 Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#76286: [PATCH] services: greetd: Use user default login shell.
Date: Sat, 22 Feb 2025 22:13:34 +0900
Hi Muradm,

muradm <mail <at> muradm.net> writes:

> Hi!
>
> Techincally looks fine, however...
>
> Initially, I intentionally didn't go with login shell. The problem is,
> you can't write 'bash -l` in passwd database.
> Having shell command configured in passwd, and its arguments in guix
> configuration may intiated unwanted inconsistency.
> For instance, user puts some fancy command as shell in passwd, and
> greetd sticks '-l' flag to it that nukes the hard drive - exaggeration
> to illustrate the problem :)
> Personally, I didn't feel comfortable in spreading configuration of
> one command in two unrelated places.
>
> As far as I understand, whoever uses shell configured in passwd should
> known how to invoke it.

I see, thanks for bringing my attention to the fact that greetd provides
'-l' itself.  It seems it could be awkard to honor the default user
shell and have a default '-l' added to it, which may or may not be
supported (I guess most shells do, but...)

Murilo, what do you think?  Can we close this, preserving the fully
declarative status quo?

-- 
Thanks,
Maxim




Reply sent to "Murilo" <murilo <at> disroot.org>:
You have taken responsibility. (Sat, 22 Feb 2025 15:33:07 GMT) Full text and rfc822 format available.

Notification sent to Murilo <murilo <at> disroot.org>:
bug acknowledged by developer. (Sat, 22 Feb 2025 15:33:09 GMT) Full text and rfc822 format available.

Message #19 received at 76286-done <at> debbugs.gnu.org (full text, mbox):

From: "Murilo" <murilo <at> disroot.org>
To: "Maxim Cournoyer" <maxim.cournoyer <at> gmail.com>, "muradm" <mail <at> muradm.net>
Cc: 76286-done <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#76286: [PATCH] services: greetd: Use user default login shell.
Date: Sat, 22 Feb 2025 12:31:51 -0300
Hi Maxim and muradm,

> muradm <mail <at> muradm.net> writes:
>> For instance, user puts some fancy command as shell in passwd, and
>> greetd sticks '-l' flag to it that nukes the hard drive - exaggeration
>> to illustrate the problem :)

I see, I haven't thought of this issue, thanks for your input, muradm.

On Sat Feb 22, 2025 at 10:13 AM -03, Maxim Cournoyer wrote:
> Murilo, what do you think?  Can we close this, preserving the fully
> declarative status quo?

Yes, I'm closing this, thanks for reviewing anyways Maxim, really appreciate it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 23 Mar 2025 11:24:54 GMT) Full text and rfc822 format available.

This bug report was last modified 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.