unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Nicolas Graves <ngraves@ngraves.fr>
Cc: 62461@debbugs.gnu.org
Subject: [bug#62461] Additional ssh configuration options.
Date: Sat, 01 Apr 2023 09:45:26 +0200	[thread overview]
Message-ID: <87mt3sgi5l.fsf_-_@gnu.org> (raw)
In-Reply-To: <20230326140706.32412-1-ngraves@ngraves.fr> (Nicolas Graves's message of "Sun, 26 Mar 2023 16:07:04 +0200")

Hi Nicolas,

Nice work!

Nicolas Graves <ngraves@ngraves.fr> skribis:

> ---
>  gnu/home/services/ssh.scm | 44 +++++++++++++++++++++++++++++++--------
>  1 file changed, 35 insertions(+), 9 deletions(-)

Bonus point if you add a ChangeLog-style commit log.  :-)

> +(define (serialize-add-keys-to-agent value)
> +  (define (is-valid-time-string? str)
> +    (and (> (string-length str) 0)
> +         (eq?
> +          (cdr (vector-ref
> +                (string-match "\
> +[0-9]+|([0-9]+[Ww])?([0-9]+[Dd])?([0-9]+[Hh])?([0-9]+[Mm])?([0-9]+[Ss])?" str)
> +                1))
> +          (string-length str))))

In general please use ‘match’ instead of car/cdr/cadddr (info "(guix)
Data Types and Pattern Matching").

That said, the result of ‘string-match’ is meant to be accessed with
‘match:substring’, not with ‘vector-ref’ (info "(guile) Match
Structures").

Nitpick: you can remove ‘is-’ from the name.

> +  (string-append "AddKeysToAgent "
> +                 (cond ((member value '("yes" "no" "confirm" "ask")) value)
> +                       ((is-valid-time-string? value) value)
> +                       ((and (string-prefix? "confirm" value)
> +                             (is-valid-time-string?
> +                              (cdr (string-split value #\ )))) value)
> +                       ;; The 'else' branch is unreachable.
> +                       (else (raise (condition (&error)))))))

I guess the ‘else’ branch is reachable if one uses the wrong value?
Should it instead be:

  (raise (formatted-message (G_ "~s: invalid 'add-keys-to-agent' value")
                            value))

?

Ludo’.




  parent reply	other threads:[~2023-04-01  7:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 13:58 [bug#62461] Additional ssh configuration options Nicolas Graves via Guix-patches via
2023-03-26 14:07 ` [bug#62461] [PATCH 1/3] gnu: home-openssh-configuration: Add field add-keys-to-agent Nicolas Graves via Guix-patches via
2023-03-26 14:07   ` [bug#62461] [PATCH 2/3] gnu: openssh-host: Add option match-criteria Nicolas Graves via Guix-patches via
2023-04-01  7:59     ` [bug#62461] Additional ssh configuration options Ludovic Courtès
2023-04-17 15:08       ` Nicolas Graves via Guix-patches via
2023-03-26 14:07   ` [bug#62461] [PATCH 3/3] gnu: ssh: Export configuration predicates Nicolas Graves via Guix-patches via
2023-04-01  8:00     ` [bug#62461] Additional ssh configuration options Ludovic Courtès
2023-04-01  7:45   ` Ludovic Courtès [this message]
2023-04-20  8:30 ` [bug#62461] [PATCH v2 1/4] gnu: home-openssh-configuration: Add field add-keys-to-agent Nicolas Graves via Guix-patches via
2023-04-20  8:30   ` [bug#62461] [PATCH v2 2/4] gnu: openssh-host: Add option match-criteria Nicolas Graves via Guix-patches via
2023-04-20  8:30   ` [bug#62461] [PATCH v2 3/4] gnu: ssh: Export configuration predicates Nicolas Graves via Guix-patches via
2023-04-20  8:30   ` [bug#62461] [PATCH v2 4/4] gnu: ssh: Export home-ssh-agent variables Nicolas Graves via Guix-patches via
2023-05-14 21:11   ` [bug#62461] Additional ssh configuration options Ludovic Courtès
2023-06-05 12:34 ` [bug#62461] [PATCH v3 1/4] gnu: home-openssh-configuration: Add field add-keys-to-agent Nicolas Graves via Guix-patches via
2023-06-05 12:34   ` [bug#62461] [PATCH v3 2/4] gnu: openssh-host: Add option match-criteria Nicolas Graves via Guix-patches via
2023-06-05 12:34   ` [bug#62461] [PATCH v3 3/4] gnu: ssh: Export configuration predicates Nicolas Graves via Guix-patches via
2023-06-05 12:34   ` [bug#62461] [PATCH v3 4/4] gnu: ssh: Export home-ssh-agent variables Nicolas Graves via Guix-patches via
2023-06-09 21:43   ` bug#62461: Additional ssh configuration options Ludovic Courtès
2023-07-04 20:17     ` [bug#62461] " Josselin Poiret via Guix-patches via
2023-07-21 20:23       ` Nicolas Graves via Guix-patches via

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=87mt3sgi5l.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=62461@debbugs.gnu.org \
    --cc=ngraves@ngraves.fr \
    /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).