From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YGEfELUOz2M8UwEAbAwnHQ (envelope-from ) for ; Mon, 23 Jan 2023 23:48:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id uMX+D7UOz2PvugAAauVa8A (envelope-from ) for ; Mon, 23 Jan 2023 23:48:21 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 16C6D53FE for ; Mon, 23 Jan 2023 23:48:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pK5bk-0007sD-Bt; Mon, 23 Jan 2023 17:48:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK5be-0007rv-Kl for guix-patches@gnu.org; Mon, 23 Jan 2023 17:48:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK5be-00069J-0y for guix-patches@gnu.org; Mon, 23 Jan 2023 17:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pK5bd-0003xX-TP for guix-patches@gnu.org; Mon, 23 Jan 2023 17:48:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60735] [PATCH v2 1/3] services: Add etc-hosts-service-type. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 23 Jan 2023 22:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60735 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 60735@debbugs.gnu.org Received: via spool by 60735-submit@debbugs.gnu.org id=B60735.167451406515186 (code B ref 60735); Mon, 23 Jan 2023 22:48:01 +0000 Received: (at 60735) by debbugs.gnu.org; 23 Jan 2023 22:47:45 +0000 Received: from localhost ([127.0.0.1]:55546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK5bN-0003wr-BD for submit@debbugs.gnu.org; Mon, 23 Jan 2023 17:47:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK5bL-0003we-Sy for 60735@debbugs.gnu.org; Mon, 23 Jan 2023 17:47:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK5bG-00068G-Ak; Mon, 23 Jan 2023 17:47:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=15bhVAWGHgyE//AxHSXPaDKBZ33F88SQTPJ80d4Pr5U=; b=cJ3wSNuWtJ1dsEVTvS1q nz8YvlJ9Jv8EeiRNApaXS1dUq2PSPqRAA6W1z+7BKeOTRp+LIyRl5kjx7657OKQJtkHXdEn43o7EA BklLKdbXJxZC+20Cr2UDe9fUj+WJV/39P1iPEuhqbG5VXIkU829ezfc6DO3TU7KDtn5lDo4AB8vp2 aQsCv5Tp4mtSwxIRKityp3obc2S7OFC0ZgSH/J0IYrUpfMwKC2Y4vcLT++S0wPf14CYhGF8BT6ZCs hxOkeKAJ7iqvxvtUlPCQPXBve0tV9NRL++P3Me2chwDSL1JGSQml1sE1o1YWjTm3mSisHcuteqOf6 mW6SxyvDFuuCJA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK5bF-0001oT-Gw; Mon, 23 Jan 2023 17:47:37 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quartidi 4 =?UTF-8?Q?Pluvi=C3=B4se?= an 231 de la =?UTF-8?Q?R=C3=A9volution,?= jour du Perce-neige X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 23 Jan 2023 23:47:35 +0100 In-Reply-To: (Bruno Victal's message of "Wed, 18 Jan 2023 16:54:11 +0000") Message-ID: <87edrkyik8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674514101; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=15bhVAWGHgyE//AxHSXPaDKBZ33F88SQTPJ80d4Pr5U=; b=h1eJ+6SU+AOhE/zNa/+cAhHtsPC/GCfpHro4I7Vr+5P584lUv+EEDHdAYboPOFeHOZiyvJ TKW6SXX9AkhkSOLbjYGjF8CoTfE5CHNHnWEDqIiGuxWEUkGC8l09FWgkg5LOkZzjYR6hPZ gmo7qKfNrI/OGTH5T9SGTutShtweL/8ItpCI48aH0Cn+vZkJM2R+Ok0jpPmCfAgNz47a8i aPEEfAcox43EnP56UbwI5ykvMzrhFq9ExnudAMS+nEjzZF8hPkWbEUITkfJ5O4QfsZybr+ fnf4AK+3XqaDbWehqmmmODikYpS2MqrfCu8Fd8V5MOKUiJ28rQwZECvRYPEk4g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=cJ3wSNuW; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674514101; a=rsa-sha256; cv=none; b=PqcLBI1rlbEYCYA73m5fkcS7hajBlfPokiINjNHd2TL/mdKsFu+uAvotgw+AKirC/Huy0r tBvcFN2fye9PMc3IXz6np4zH2N/zOY+hqHuXobq0TORvyD8L5T1yPWifLuhgE5L8gvo3y7 tPhVSlEYq37vpHLzkhWjZRHhu+cMvijfCcIbMbg4rRkUx2lxJ7GKz1h2JmlxcxN5kRtdib pXesz2MVAVe/3yw+tDfaWZEUBbj9NzsY+Tvct1jJuH4S9MuX/J3E2k9rV2sC6/tbkimTM6 d3PnxLFXp2DSMVqW/8QIVbGfx3/0EcqXPFQpuq+apSebD0J2hFVs+c4luLCNaA== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=cJ3wSNuW; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.49 X-Spam-Score: -2.49 X-Migadu-Queue-Id: 16C6D53FE X-Migadu-Scanner: scn1.migadu.com X-TUID: 2QgqgEhTE92M Bruno Victal skribis: > * gnu/services.scm (etc-hosts-service-type): New variable. > * doc/guix.texi: Document it. Other things that crossed my mind; sorry for not noticing earlier! > +++ b/gnu/services.scm Should this be in (gnu services base) instead? > + (make-compound-condition > + (formatted-message (G_ "hostname '~a' contains invalid characters.= ") No period please. > +(define-record-type* host-entry > + make-host-entry host-entry? > + (address host-entry-address) > + (canonical-name host-entry-canonical-name > + (sanitize assert-valid-name)) > + (aliases host-entry-aliases > + (default '()) > + (sanitize (cut map assert-valid-name <>)))) > + > +(define* (host address canonical-name #:optional (aliases '())) > + "More compact way of creating records" > + (make-host-entry address canonical-name aliases)) I just realized that =E2=80=98make-host-entry=E2=80=99 won=E2=80=99t run an= y sanitizer, oops! So you have to use =E2=80=98host-entry=E2=80=99: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (define-record-type* host-entry make-host-entry host-entry? (address host-entry-address) (canonical-name host-entry-canonical-name (sanitize assert-valid-name)) (aliases host-entry-aliases (default '()) (sanitize (cut map assert-valid-name <>)))) scheme@(guile-user)> ,optimize (make-host-entry 1 2 3) $12 =3D (make-struct/simple #{% rtd}# 1 2 3) scheme@(guile-user)> ,optimize (host-entry (address 1) (canonical-name 2)) $13 =3D (let ((canonical-name (assert-valid-name 2))) (if (eq? #{% abi-cookie}# 796283273607885551) (if #f #f) (throw 'record-abi-mismatch-error 'abi-check "~a: record ABI mismatch; recompilation needed" (list #{% rtd}#) '())) (let ((aliases ((cut map assert-valid-name <>) '()))) (make-struct/simple #{% rtd}# 1 canonical-name aliases))) --8<---------------cut here---------------end--------------->8--- Also, there=E2=80=99s a naming confusion between =E2=80=98host=E2=80=99 and= =E2=80=98host-entry=E2=80=99; you should choose one or the other IMO. Thanks, Ludo=E2=80=99.