unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Shepherd and the --silent option
@ 2024-08-15 10:06 Dariqq
  2024-09-08 21:55 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Dariqq @ 2024-08-15 10:06 UTC (permalink / raw)
  To: guix-devel

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

Hi Guix,

Lately I've been a bit annoyed by messages from the home shepherd when 
logging in trough a tty.

The shepherd help output advertises --silent/--quiet options to not 
output to stdout but looking through the shepherd repository this 
options are doing nothing.

The other day I was able to hack something together which from limited 
testing seems to make those options work (with a corresponding patch to 
add --silent to the home-shepherd launch script). I have attached my 
surprisingly simple diff (which applies on top of devel branch).

It was not clear to me weather boolean variables should be suffixed 
wirth "?". When it got removed in [1] a long time ago it was unsuffixed.

I have tested the patched devel shepherd and a similar diff on top of 
0.10.5 and seems to work as I expect it: The output to stdout is no 
longer there but still available in the shepherd log file.

Slightly related I noticed an issue with the devel shepherd invoked via 
guix home not daemonizing blocking my login manager.

I hope this useful for someone else as well.
Dariqq

[1] 
https://git.savannah.gnu.org/cgit/shepherd.git/commit/?id=e86cfe28c14d734fe917e4935d72e7ad2cc9b299

[-- Attachment #2: shepherd-silence.diff --]
[-- Type: text/x-patch, Size: 2058 bytes --]

diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 6051ffa..52bd526 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -493,6 +493,10 @@ If @code{-} is specified as file name, commands will be read from
 standard input, one per line, as would be passed on a @command{herd}
 command line (@pxref{Invoking herd}).
 
+@item -S
+@itemx --silent
+Don't do output to stdout.
+
 @item --quiet
 Synonym for @code{--silent}.
 
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 8f1d727..7e8c68c 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -384,6 +384,7 @@ (define (main . args)
 	(socket-file default-socket-file)
         (pid-file    #f)
         (secure      #t)
+        (silent?     #f)
         (logfile     #f))
     ;; Process command line arguments.
     (process-args (program-name) args
@@ -395,15 +396,13 @@ (define (main . args)
 		    #:takes-argument? #f
 		    #:description (l10n "synonym for --silent")
 		    #:action (lambda ()
-                               ;; XXX: Currently has no effect.
-                               #t))
+                               (set! silent? #t)))
 		  (option
 		    #:long-name "silent" #:short-name #\S
 		    #:takes-argument? #f
 		    #:description (l10n "don't do output to stdout")
 		    #:action (lambda ()
-                               ;; XXX: Currently has no effect.
-                               #t))
+                               (set! silent? #t)))
 		  (option
 		    ;; It might actually be desirable to have an
 		    ;; ``insecure'' setup in some circumstances, thus
@@ -469,7 +468,7 @@ (define (main . args)
                    (%current-service-output-port
                     ;; Send output to log and clients.
                     (make-shepherd-output-port
-                     (if syslog?
+                     (if (or silent? syslog?)
                          ;; By default we'd write both to /dev/log and to
                          ;; stdout.  Redirect stdout to the bitbucket so we
                          ;; don't log twice.

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

* Re: Shepherd and the --silent option
  2024-08-15 10:06 Shepherd and the --silent option Dariqq
@ 2024-09-08 21:55 ` Ludovic Courtès
  2024-09-09  8:26   ` Dariqq
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2024-09-08 21:55 UTC (permalink / raw)
  To: Dariqq; +Cc: guix-devel

Hi,

Dariqq <dariqq@posteo.net> skribis:

> The other day I was able to hack something together which from limited
> testing seems to make those options work (with a corresponding patch
> to add --silent to the home-shepherd launch script). I have attached
> my surprisingly simple diff (which applies on top of devel branch).
>
> It was not clear to me weather boolean variables should be suffixed
> wirth "?". When it got removed in [1] a long time ago it was
> unsuffixed.
>
> I have tested the patched devel shepherd and a similar diff on top of
> 0.10.5 and seems to work as I expect it: The output to stdout is no
> longer there but still available in the shepherd log file.

Oh, not sure what the deal was with that 2013 commit.  :-)

Anyway your patch looks great to me; finally pushed as
6ffe404ffe794b06fddd304a963a47b62444edfa in ‘devel’.

> Slightly related I noticed an issue with the devel shepherd invoked
> via guix home not daemonizing blocking my login manager.

Weird; I haven’t tried this yet, I’ll give it a try.

Thanks,
Ludo’.


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

* Re: Shepherd and the --silent option
  2024-09-08 21:55 ` Ludovic Courtès
@ 2024-09-09  8:26   ` Dariqq
  0 siblings, 0 replies; 3+ messages in thread
From: Dariqq @ 2024-09-09  8:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On 08.09.24 23:55, Ludovic Courtès wrote:

> 
> Oh, not sure what the deal was with that 2013 commit.  :-)
> 
> Anyway your patch looks great to me; finally pushed as
> 6ffe404ffe794b06fddd304a963a47b62444edfa in ‘devel’.
> 

Awesome, thanks :).

Would it be possible to also expose --silent as an option for the 
home-shepherd auto-start script once it does something in a stable version?

>> Slightly related I noticed an issue with the devel shepherd invoked
>> via guix home not daemonizing blocking my login manager.
> 
> Weird; I haven’t tried this yet, I’ll give it a try.
> 

I think the issue is that the shepherd config generated by guix-home uses

(action 'root 'daemonize)

which is deprecated in 0.10 and on the devel branch seems to create a 
new action rather than invoking it. (So no error too).

When I change to the new way

(perform-service-action root-service 'daemonize)

daemonizing works.


Should guix-home be backwards compatible with older shepherds given that 
shepherd-0.8 and shepherd-0.9 are still packaged?

> Thanks,
> Ludo’.




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

end of thread, other threads:[~2024-09-09  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 10:06 Shepherd and the --silent option Dariqq
2024-09-08 21:55 ` Ludovic Courtès
2024-09-09  8:26   ` Dariqq

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