unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Deck Pickard <deck.r.pickard@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] services: lsh: Add "graceful" handling of daemonic option.
Date: Sat, 6 Dec 2014 23:29:30 +0100	[thread overview]
Message-ID: <CAJ41eexCdX-LV_ARd=vt1vUQksfTnnwS+pBBd1gCD0yrJeWZAw@mail.gmail.com> (raw)
In-Reply-To: <87k324zwbx.fsf@gnu.org>

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

On 6 Dec 2014 15:28, "Ludovic Courtès" <ludo@gnu.org> wrote:
>
> Deck Pickard <deck.r.pickard@gmail.com> skribis:
>
> > From 1fef935d6292016c04b9234eedb5dcaf006dc152 Mon Sep 17 00:00:00 2001
> > From: nebuli <nebu@kipple>
> > Date: Wed, 3 Dec 2014 22:51:48 +0100
> > Subject: [PATCH] services: lsh: Add graceful handling of daemonic
option.
> >
> > * doc/guix.texi: Mention use case.
> > * gnu/services/ssh.scm (lsh-service): New #:keys (daemonic?, pid-file?,
> >   pid-file).  Build new lshd-command and expand service-requirement
> >   field.
>
> Nice!
>
> >  (define* (lsh-service #:key
> >                        (lsh lsh)
> > +                      (daemonic? #f)
> >                        (host-key "/etc/lsh/host-key")
> >                        (interfaces '())
> >                        (port-number 22)
> >                        (allow-empty-passwords? #f)
> >                        (root-login? #f)
> >                        (syslog-output? #t)
> > +                      (pid-file? #f)
> > +                      (pid-file "/var/run/lshd.pid")
> >                        (x11-forwarding? #t)
> >                        (tcp/ip-forwarding? #t)
> >                        (password-authentication? #t)
>
> I would be tempted to not expose #:daemonic?, #:pid-file? and
> #:syslog-output?, and instead always use --daemonic --pid-file=...
>
> In particular, when using --daemonic, having the PID file is required,
> otherwise dmd won’t know what the PID of this process is, and thus will
> be unable to control it.  For that reason, #:pid-file? must not be
> exposed.
>
> WDYT?

I implemented this because, from what I gather, lshd will write to syslog
only in '--daemonic' mode, otherwise it spams the controlling terminal on
which dmd is running. And I wanted lsh to use syslog!

As it is now, dmd captures the right PID from the "make-fork" constructor
alone, while having no idea of pid files; I went as far as to write dmd
service (and 'deco sideloding' it), which printed out both PIDs, they were
eqv...

There might still remain a use case with daemonic? equal to false for
someone out there, even for simple reason of lack of functioning syslog (as
well as a use case of choosing not to log at all), shrug...

Change default to (daemonic? #t) and adjust the docs? Your call...
I did not mention pid file related keys in the docs, because it would be
only useful to someone who had to bother to look at actual lsh-service
signature, like someone who did need pid file for some strange purpose...

>
> > +  (define requires
> > +    (if (and daemonic? syslog-output?)
> > +        '(networking syslogd)
> > +        '(networking)))
>
> If we agree on the above, that would become '(networking syslogd)
> unconditionally.
>

No, as I explained; one thing is having a chosen set of defaults, another
removing flexibility... lsh and/or dmd behaviour could change or someone
could like to rewrite lsh service definition.

> >      (return (service
> >               (documentation "GNU lsh SSH server")
> >               (provision '(ssh-daemon))
> > -             (requirement '(networking))
> > +             (requirement #~(#$@requires))
>
> This is strictly equivalent to:
>
>   (requirement `(,@requires))
>
> or simply:
>
>   (requirement requires)
>
> :-)
>
> G-expressions are only needed when capturing references to /gnu/store
> items, packages, etc.
>
> Thanks,
> Ludo’.

Roger, still groking my way around, at least it doesn't matter apart from
couple useless macro expansions.
Drp,
-- 
(or ((,\ (x) `(,x x)) '(,\ (x) `(,x x))) (smth (that 'like)))

[-- Attachment #2: Type: text/html, Size: 4804 bytes --]

  reply	other threads:[~2014-12-06 22:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJ41eewmqwPhQXZRJXdJuHGA=sSRJG7dK86sWfCgusb+AXBNxg@mail.gmail.com>
2014-12-04 22:24 ` [PATCH] services: lsh: Add "graceful" handling of daemonic option Deck Pickard
2014-12-06 14:28   ` Ludovic Courtès
2014-12-06 22:29     ` Deck Pickard [this message]
2015-02-08 20:56   ` Ludovic Courtès

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='CAJ41eexCdX-LV_ARd=vt1vUQksfTnnwS+pBBd1gCD0yrJeWZAw@mail.gmail.com' \
    --to=deck.r.pickard@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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).