Subject: Re: [bug#55912] [PATCH] home: Add OpenSSH service.

From: Maxime Devos <[email-masked]>
Date: Mon, 13 Jun 2022 23:58:32 +0200

Ludovic Courtès schreef op ma 13-06-2022 om 11:41 [+0200]:
> > TCP only allows natural numbers up to some bound, and in practice
> > implementations only support non-zero natural numbers, so maybe the
> > predicate can be refined a bit?
> 
> We could do that, though that’s more code for little in return…

Input validation is generally considered good practice.  This has
recently been rediscovered in, say,
<https://lists.gnu.org/archive/html/guix-devel/2022-02/msg00140.html>.

The little extra code is trivial (just an new predicate doing some
bounds checks and exact-integer?) and:

  * I believe that simply implementing the tiny procedure is less
    expensive than doing a proper cost-benefit analysis

  * the cost is only once, it's not a recurring cost

  * the cost is trivial

  * the new predicate can benefit _all_ services handling network ports

  * it would benefit _all_ users of OpenSSH that might make a typo
    or such.  Likewise for other network services.

  * the benefit is not only once, it's recurring

  * cost of not doing checks:
    error messages that don't appear during "guix home reconfigure"
    inside Guix, and instead appear later during using the new Home
    from within external software even though the error was in the
    Guix Home.  Becomes rather complicated.

(Slight benefit, multiplied over many uses & much time -> large benefit
compared to the tiny one-time investment.)

Greetings,
Maxime.