From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 YOG9AD4Wz2MoYQAAbAwnHQ (envelope-from ) for ; Tue, 24 Jan 2023 00:20:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cNfaAD4Wz2P8xQAA9RJhRA (envelope-from ) for ; Tue, 24 Jan 2023 00:20:30 +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 D0D8A66B1 for ; Tue, 24 Jan 2023 00:20:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pK66e-0002no-1D; Mon, 23 Jan 2023 18:20:04 -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 1pK66c-0002na-Qr for guix-patches@gnu.org; Mon, 23 Jan 2023 18:20:02 -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 1pK66c-0002gu-IV for guix-patches@gnu.org; Mon, 23 Jan 2023 18:20:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pK66b-0004ln-Sg for guix-patches@gnu.org; Mon, 23 Jan 2023 18:20:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60735] [PATCH v2 2/3] system: Deprecate hosts-file. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 23 Jan 2023 23:20: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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 60735@debbugs.gnu.org Received: via spool by 60735-submit@debbugs.gnu.org id=B60735.167451596418279 (code B ref 60735); Mon, 23 Jan 2023 23:20:01 +0000 Received: (at 60735) by debbugs.gnu.org; 23 Jan 2023 23:19:24 +0000 Received: from localhost ([127.0.0.1]:55573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK660-0004kl-8y for submit@debbugs.gnu.org; Mon, 23 Jan 2023 18:19:24 -0500 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:42788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK65y-0004kc-My for 60735@debbugs.gnu.org; Mon, 23 Jan 2023 18:19:23 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.172]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id B641A20A68; Tue, 24 Jan 2023 00:19:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 4B7FB80096; Tue, 24 Jan 2023 00:19:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-1.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id JCXMgzwFNquu; Tue, 24 Jan 2023 00:19:11 +0100 (CET) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 7F31780093; Tue, 24 Jan 2023 00:19:11 +0100 (CET) Message-ID: Date: Mon, 23 Jan 2023 23:19:00 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US References: <87o7qoyj0i.fsf@gnu.org> From: Bruno Victal In-Reply-To: <87o7qoyj0i.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674516029; a=rsa-sha256; cv=none; b=suvTWx97pakeLAB+Y9TSIZhMU7t4xJ9+828JuDmnzC2YyW6N/qbxNm+uicgqXq2QLlOsbY 1BiyFFF4KhAoCGyAFuskx0K7BX+T68m9Fab4NcNfk6lRmKu1MHhgR/OIb0MUZTxraUGCZQ j0Q5rgU1gLrkDsSfkdamfWpT2O+WxLim/NYHHAI7TpyXJxXVpSg9f+bCIaZmJQ+0cR2iiQ Mkt2eL5/+WD1r+XySBTerqGQD/u07ciawhwU+PbHdL5ilxh5hKV7tt1o+rzmKCaHuNO/hI C0rvlCwFV0magueyVeDQTe38uSdEUSaUjRI1UvB0DJPcnX533yZFwR1Gx2fGXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674516029; 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; bh=031okna+Hcb+8MqG+6Wp15Aj0Xd3VuvNwO2kW7iFA0s=; b=S+2NATXjYdd54Bg/ZkcgT5k0gj7rhArn/S3UT6cfi/cPPPWduyhrv5rw8xH5J52OEdz5TV 7CUmEr2ZBrXMK7EHLj9eLNccgBfyvqK/xYGFWOiosTLoGU2whMSbHJ1LF1oo0LaCaLjHC0 3VaGPzK7Xfy/gQWpur4WGcMJU4TUx8EuVpNvgfJ4Fa5TrvJw9osTNUW7Tzyxn/PWwth95O 6zthpdr6ARl5iLHWzRFI1la96mv16IO8+ttUfsa1D/iqMSVjvZ+32spNozcZilsi0l33ZR dxzWelN5x6LNPRi7bLbscXmEFlrEzeQhYEmPmkDV6JP811ImWd/KJ5q2dQlIoQ== X-Spam-Score: -3.19 X-Migadu-Queue-Id: D0D8A66B1 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; 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"; dmarc=none X-Migadu-Spam-Score: -3.19 X-TUID: +Ld/waW1qQ0J On 2023-01-23 22:37, Ludovic Courtès wrote: > Bruno Victal skribis: > >> --- >> >> WIP, the ganeti tests fail because host-name is added as an alias of localhost. > > Before these patches, ‘host-name’ was already an alias of ‘localhost’. > Is there something else interfering? In some cases, it's not desired for host-name to be an alias of localhost. The ganeti tests did this by passing a hosts-file file-like object where host-name wasn't an alias of localhost. I've brainstormed a bit on this and here's what I thought: Approach 1 (DOESN'T WORK): * hosts-service-type in essential-services (gnu/systems.scm), default value: 127.0.0.1 localhost ::1 localhost * simple-service extension on base-services (gnu/services/base.scm): \\FLOPS since both /etc/hosts and /etc/hostname are provisioned with activation-service-type. This means we can't write /etc/hosts AFTER /etc/hostname or host-name-service-type is ready. Approach 2: * NO /etc/hosts in essential-services (is this possible?) * is an absent /etc/hosts (or absent %base-services) a valid OS? * Value set in %base-services, hosts-service-type as a ONE-SHOT shepherd service. * Can be changed with modify-services. * It's a one-shot shepherd service since we're depending on /etc/hostname which is activation-service-type. (we're depending on either etc-service-type or host-name-service-type) Approach 3: * Do not set our hostname as an alias of localhost by default. * Manpage doesn't seem to make this mandatory, in fact, our hostname can point to any IP. (it says 'often', not 'mandatory') * We only set localhost name. * Is this mandatory? If not, there might be cases where this entry is undesired. > >> + (simple-service 'block-facebook-hosts hosts-service-type >> + (let ((host-pairs >> + (filter-map >> + (lambda (x) >> + (and (not (or (string-null? x) >> + (string-prefix? "#" x))) >> + (remove string-null? >> + (string-split >> + x >> + char-set:whitespace)))) >> + (string-split %facebook-host-aliases #\newline)))) >> + (map (match-lambda >> + ((addr name) >> + (host addr name))) >> + host-pairs))) > > It doesn’t matter because it’s removed in the commit that follows I > think using ‘string-tokenize’ instead of ‘string-split’ may bring > simplifications. It was added because otherwise the "split" commits would seem to be missing some context. I can leave it as is, delete it here or try your suggestion. >> +++ b/gnu/system.scm >> @@ -14,6 +14,7 @@ >> ;;; Copyright © 2020, 2022 Efraim Flashner >> ;;; Copyright © 2021 Maxime Devos >> ;;; Copyright © 2021 raid5atemyhomework >> +;;; Copyright © 2023 Bruno Victal >> ;;; >> ;;; This file is part of GNU Guix. >> ;;; >> @@ -31,6 +32,7 @@ >> ;;; along with GNU Guix. If not, see . >> >> (define-module (gnu system) >> + #:use-module (guix discovery) > > Do we really need this module? IIRC this was for the deprecated procedures to work. Can they work without this module? Cheers, Bruno