unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command.
@ 2015-03-10 13:23 宋文武
  2015-03-10 13:23 ` [PATCH 2/2] services: slim: Pass SESSION to ~/.xsession as "$1" 宋文武
  2015-03-12 20:15 ` [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: 宋文武 @ 2015-03-10 13:23 UTC (permalink / raw)
  To: guix-devel

* gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence
  of COMMAND.  Only run ~/.xsession when it exists.
---
 gnu/services/xorg.scm | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 912cbd3..ae3a9ad 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -158,26 +158,26 @@ which should be passed to this script as the first argument.  If not, the
           ;; environment variables that one gets when logging in on a tty, for
           ;; instance.
           (let* ((pw    (getpw (getuid)))
-                 (shell (passwd:shell pw))
-                 (st    (stat command #f)))
-            (when (and st (not (zero? (logand (stat:mode st) #o100))))
-              ;; Close any open file descriptors.  This is all the more
-              ;; important that SLiM itself exec's us directly without closing
-              ;; its own file descriptors!
-              (close-all-fdes)
+                 (shell (passwd:shell pw)))
+            ;; Close any open file descriptors.  This is all the more
+            ;; important that SLiM itself exec's us directly without closing
+            ;; its own file descriptors!
+            (close-all-fdes)
 
-              ;; The '--login' option is supported at least by Bash and zsh.
-              (execl shell shell "--login" "-c"
-                     (string-join (cons command args))))))
+            ;; The '--login' option is supported at least by Bash and zsh.
+            (execl shell shell "--login" "-c"
+                   (string-join (cons command args)))))
 
-        (let ((home (getenv "HOME"))
-              (session (match (command-line)
-                         ((_ x) x)
-                         (_     #$fallback-session))))
-          ;; First, try to run ~/.xsession.
-          (exec-from-login-shell (string-append home "/.xsession"))
-          ;; Then try to start the specified session.
-          (exec-from-login-shell session))))
+        (let* ((home (getenv "HOME"))
+               (xsession-file (string-append home "/.xsession"))
+               (session (match (command-line)
+                          ((_ x) x)
+                          (_     #$fallback-session))))
+          (if (file-exists? xsession-file)
+              ;; Run ~/.xsession when it exists.
+              (exec-from-login-shell xsession-file)
+              ;; Otherwise, start the specified session.
+              (exec-from-login-shell session)))))
   (gexp->script "xinitrc" builder))
 
 \f
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] services: slim: Pass SESSION to ~/.xsession as "$1".
  2015-03-10 13:23 [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command 宋文武
@ 2015-03-10 13:23 ` 宋文武
  2015-03-12 20:15   ` Ludovic Courtès
  2015-03-12 20:15 ` [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: 宋文武 @ 2015-03-10 13:23 UTC (permalink / raw)
  To: guix-devel

* gnu/services/xorg.scm (xinitrc)[builder]: Pass SESSION to ~/.xsession.
---
 gnu/services/xorg.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index ae3a9ad..728544b 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -175,7 +175,7 @@ which should be passed to this script as the first argument.  If not, the
                           (_     #$fallback-session))))
           (if (file-exists? xsession-file)
               ;; Run ~/.xsession when it exists.
-              (exec-from-login-shell xsession-file)
+              (exec-from-login-shell xsession-file session)
               ;; Otherwise, start the specified session.
               (exec-from-login-shell session)))))
   (gexp->script "xinitrc" builder))
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command.
  2015-03-10 13:23 [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command 宋文武
  2015-03-10 13:23 ` [PATCH 2/2] services: slim: Pass SESSION to ~/.xsession as "$1" 宋文武
@ 2015-03-12 20:15 ` Ludovic Courtès
  2015-03-13 14:59   ` 宋文武
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-03-12 20:15 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> * gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence
>   of COMMAND.  Only run ~/.xsession when it exists.

[...]

> +        (let* ((home (getenv "HOME"))
> +               (xsession-file (string-append home "/.xsession"))
> +               (session (match (command-line)
> +                          ((_ x) x)
> +                          (_     #$fallback-session))))

Could you align the right-hand sides of the ‘let*’?

> +          (if (file-exists? xsession-file)
> +              ;; Run ~/.xsession when it exists.
> +              (exec-from-login-shell xsession-file)

This will fail if ~/.xsession is not executable.  It could use
‘executable-file?’ from (guix build utils), but OTOH it may be better to
just fail in this case since it’s most likely a user error.

Thoughts?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] services: slim: Pass SESSION to ~/.xsession as "$1".
  2015-03-10 13:23 ` [PATCH 2/2] services: slim: Pass SESSION to ~/.xsession as "$1" 宋文武
@ 2015-03-12 20:15   ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2015-03-12 20:15 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> * gnu/services/xorg.scm (xinitrc)[builder]: Pass SESSION to ~/.xsession.

OK!

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command.
  2015-03-12 20:15 ` [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command Ludovic Courtès
@ 2015-03-13 14:59   ` 宋文武
  0 siblings, 0 replies; 5+ messages in thread
From: 宋文武 @ 2015-03-13 14:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> * gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence
>>   of COMMAND.  Only run ~/.xsession when it exists.
>
> [...]
>
>> +        (let* ((home (getenv "HOME"))
>> +               (xsession-file (string-append home "/.xsession"))
>> +               (session (match (command-line)
>> +                          ((_ x) x)
>> +                          (_     #$fallback-session))))
>
> Could you align the right-hand sides of the ‘let*’?
>
>> +          (if (file-exists? xsession-file)
>> +              ;; Run ~/.xsession when it exists.
>> +              (exec-from-login-shell xsession-file)
>
> This will fail if ~/.xsession is not executable.  It could use
> ‘executable-file?’ from (guix build utils), but OTOH it may be better to
> just fail in this case since it’s most likely a user error.
I'm OK to fail here.

Pushed, thanks for review!
>
> Thoughts?
>
> Thanks,
> Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-13 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 13:23 [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command 宋文武
2015-03-10 13:23 ` [PATCH 2/2] services: slim: Pass SESSION to ~/.xsession as "$1" 宋文武
2015-03-12 20:15   ` Ludovic Courtès
2015-03-12 20:15 ` [PATCH 1/2] services: slim: Allow non-absolute path to be used as session command Ludovic Courtès
2015-03-13 14:59   ` 宋文武

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).