From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QBX1D4ehrGPASQAAbAwnHQ (envelope-from ) for ; Wed, 28 Dec 2022 21:05:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aGjtD4ehrGMHygAA9RJhRA (envelope-from ) for ; Wed, 28 Dec 2022 21:05:27 +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 DD9ABFEB3 for ; Wed, 28 Dec 2022 21:05:26 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAcfg-0002oR-8C; Wed, 28 Dec 2022 15:05: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 1pAcfe-0002oF-Mk for guix-patches@gnu.org; Wed, 28 Dec 2022 15:05: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 1pAcfe-0004ew-EK for guix-patches@gnu.org; Wed, 28 Dec 2022 15:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pAcfe-0004Iu-8b for guix-patches@gnu.org; Wed, 28 Dec 2022 15:05:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#56046] [PATCH opensmtpd-records v3] services (opensmtpd): add opensmtpd records to enhance opensmtpd-configuration. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Dec 2022 20:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56046 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Joshua Branson Cc: Joshua Branson , 56046@debbugs.gnu.org Received: via spool by 56046-submit@debbugs.gnu.org id=B56046.167225788316499 (code B ref 56046); Wed, 28 Dec 2022 20:05:02 +0000 Received: (at 56046) by debbugs.gnu.org; 28 Dec 2022 20:04:43 +0000 Received: from localhost ([127.0.0.1]:58772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAcfK-0004I2-MK for submit@debbugs.gnu.org; Wed, 28 Dec 2022 15:04:43 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAcfI-0004Hj-JG for 56046@debbugs.gnu.org; Wed, 28 Dec 2022 15:04:41 -0500 Received: by mail-wm1-f66.google.com with SMTP id fm16-20020a05600c0c1000b003d96fb976efso9721512wmb.3 for <56046@debbugs.gnu.org>; Wed, 28 Dec 2022 12:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=+t2AJ0Ecz3e4yBItYqH/Za3vKi49wDyaIhZX5Jq1Xiw=; b=orhj6lFnqAlhT0QMQYhffRrIrs1is/7RT/psqrr2IWsY7g/EPoCu0VaT2Z1VHtzPvm VZlQNgOPuL5al/gIc8uwX7dd95jswCyEIhaykx0fW1EiJYCOdRUg1doTKXqsEESDkvLx pdOC/4G/rUkgBSxPhVxY5ezt9FW89acqjNf0YS+1L3/L8sthEBXfQxIST7mr+E7dr0kg Dr9suiSSM381/PZnLimqIhRKoaQVqLv5S7p3f99Oeoh+kWMf7H86S4BRkB124spXouVn vdkYXhWVyDOjuDuF3j3/H5IndXGkP/RzgWs3EkS+C8JR2L7dKRSxuVNtb3mWAYNBFEFh oVMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+t2AJ0Ecz3e4yBItYqH/Za3vKi49wDyaIhZX5Jq1Xiw=; b=k7k5zcdVYlXR1M1K15kHNBb8cGoHwdgAwAxHYzZ0fRMYCrhBTP0dFhp6xxgh1iTOqB GGp9SZjVx+ukc8lGSjJjFL20GV/Sy340ctFRzIg78IF0iPt1R0lkBlCdSOZvuvFBjUk6 251TaijVXwTqCCtvUjeHMAf4WX/DnY9WJBPDQZHa3OkyxGnoyiaurqb+ucGEoo+ZeqMu IIoaPwfVXk4YgPBXKq3UBa5t02oRh/Rm+4Fj+2qyCznKM6Lrqv5Ue07ZE1cRyk03PAw0 ZECbCWHLpg7OPLlWE4xLDi1tAK3kypr3FKtOuvtaokddGK6jXNHyAjC2ERIK98tmXRMa /iJQ== X-Gm-Message-State: AFqh2koazxuegioRx69KY7Q4teatvQkxvtsSm95kGmRbO4e6RzSrzFPi gi+tg2URPi6aSGeiuzhRjnc= X-Google-Smtp-Source: AMrXdXsInIc7/OuzPLAiloKFvdycWkuHlQg8vHm/ST8hzNt+CqielNzmWPrkF/uSABu+6D5UhaQTlQ== X-Received: by 2002:a05:600c:4e48:b0:3cf:5d41:b748 with SMTP id e8-20020a05600c4e4800b003cf5d41b748mr21652684wmq.36.1672257874730; Wed, 28 Dec 2022 12:04:34 -0800 (PST) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id t14-20020a05600c198e00b003d990ec74ccsm5494971wmq.46.2022.12.28.12.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 12:04:34 -0800 (PST) Message-ID: <91b2d3a6834780b36b876dd55699c2941349b5bf.camel@gmail.com> From: Liliana Marie Prikler Date: Wed, 28 Dec 2022 21:04:32 +0100 In-Reply-To: <87k02co01c.fsf@dismail.de> References: <8001f404c0e54baba71ef9c5536abc54275c4167.1671803496.git.joshua@gnucode.me> <37239abae388f1fadcba559b62c0aae07de9d319.camel@gmail.com> <87k02co01c.fsf@dismail.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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=1672257927; 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=+t2AJ0Ecz3e4yBItYqH/Za3vKi49wDyaIhZX5Jq1Xiw=; b=CRj/xhw53my2Bc/TA3E9142R8PaGAANz92H1z7wdimIweJ5KATrdzGi+VuzRnC5OdYipxM Zbm37zitmBkwr5hbtF5YA4UQi7EGct+eZUVL7/noCxrrcDdaVkme3C3xzSDs3jvHuGu2kU B6RHbl65wsLfYsnwzuGnxH+Dvi74Yqs8lJ7zaOxX0b17vC/QNdtP7/WgmpwUtuKJ6PGJoQ ckPkzDqgz8eX0PoMwEXBe6xuk59AHL2VlRpkk59RYGl2p+4lZ5zHcBBZUUcgFCI8KeNxyh tobfQNQbXQ06xruyCKlWaooCZNhrJlmz9zvYTJLt3mufZl6bLQhLgvkz0BQ1cw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=orhj6lFn; 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=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1672257927; a=rsa-sha256; cv=none; b=ClyF2bQ1KqOUD31Fd011CHmuQKbR9rEq4hXLmAJn+6rqLZrpseLMJRGbdydHWldI+GdyUG ueSQ+qd0Kt8Ye1k+of/LTiiRKyR7+qVGdgyK/92VPQBqTdOs4pfjpGYmrdM4Ikn2+GeUMA afzuM4DQOgsueN/1d8UiACikDjScPbh09zS9cp/vTcfMpdoc/9M4TpbQqHzwB7SllejndK bshHvZpWp4paN3RZ6e0BXBaJO2WeHnBJVAPes89OYS+yt5lqcM1oycpAb1eETVJ7z7K+Vg pw+l+LbmonQDzz68xkZ3QSaRX31RE0kbIa9YjdLmfwek4ryIAKMgL/4EI6icxA== X-Spam: Yes X-Migadu-Queue-Id: DD9ABFEB3 X-Migadu-Spam: Yes X-Spam-Score: 7.47 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=orhj6lFn; 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=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 7.47 X-TUID: uKF20jmolwWF Am Dienstag, dem 27.12.2022 um 19:16 -0500 schrieb Joshua Branson: > Are you giving me a triple A+ ? :) Org generated the the like that. I > think you mentioned that I should use fractions last time. Sorry I > did not do that. Do you have to convert your documentation from org? Writing Texinfo code manually is an option, as is generating it from define- configuration IIRC. There is also nothing wrong with manually touching up generated docs, but I imagine doing so consistently might be a bit more adventurous. > If I wait 'til I implement every one of your suggestions, I will > probably never submit it. I am really probably "perfecting" this > service. You can submit whatever, but don't expect me or any other committer to upstream the patches while there are open points to address. >=20 > > Instead of a string, take 'no-verify as symbol perhaps? >=20 > Sounds good to me. May I ask why you prefer a symbol instead of a > string? Symbols can be compared with eq?, case et al. > > > -;;; > > > =C2=A0;;; OpenSMTPD. > > > =C2=A0;;; > > > +;;; This next bit of code helps me create my own sanitizer > > > functions. > > > + > > > +;; some fieldnames have a default value of #f, which is ok.=C2=A0 > > > They > > > cannot have > > > +;; a value of #t. > > > +;; for example opensmtpd-table-data can be #f, BUT NOT true. > > > +;; my/sanitize procedure tests values to see if they are of the > > > right kind. > > > +;; procedure false? is needed to allow fields like 'values' to > > > be > > > blank, > > > +;; (empty), or #f BUT also have a value like a list of strings. > > Use less egocentric comments ;) >=20 > I'm not sure what you mean here? I know I had a comment in my task > list that said something like my sanitizer function are probably > better than those found in guix. Apologies for that. For what it's worth, it definitely wasn't I. [1] > >=20 > > > +(define (false? var) > > > +=C2=A0 (eq? #f var)) > > > + > > > +;; TODO I have to have this procedure, or I need to change > > > my/sanitize > > > +;; procedure. > > > +(define (my-file-exists? file) > > > +=C2=A0 (and (string? file) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (access? file F_OK))) > > Does file-exists? not work for you? >=20 > The file-exists? function causes my-sanitize function to break. Why? > I think.=C2=A0 Prove it. > If you get rid of it, then what happens when a user types in (file > 4), you get an raise-exception.=C2=A0 (file-exists? "(file 4)") ; =3D> #f > I can probably just rework my-sanitizer function to > deal with that possibility, but I have not yet. I would love some > guidance on how to do that. Because I feel like having to handle that > exception is hard. >From the Guile manual: -- Scheme Procedure: stat object [exception-on-error?] -- C Function: scm_stat (object, exception_on_error) [...] If the optional EXCEPTION_ON_ERROR argument is true, which is the default, an exception will be raised if the underlying system call returns an error, for example if the file is not found or is not readable. Otherwise, an error will cause =E2=80=98stat=E2=80=99 to re= turn =E2=80=98#f=E2=80=99. Now, in (ice-9 boot-9), file-exists? is defined (assuming posix) as (lambda (str) (->bool (stat str #f))) Thus, I am pretty sure that no exception should be raised from the check ;) > >=20 > > > +;; This procedure takes in a var and a list of procedures.=C2=A0 It > > > loops > > > through > > > +;; list of procedures passing in var to each. > > > +;; if one procedure returns #t, the function returns true.=C2=A0 > > > Otherwise #f. > > > +;; TODO for fun rewrite this using map > > > +;; If I rewrote it in map, then it may help with sanitizing. > > > +;; eg: I could then potentially easily sanitize vars with lambda > > > procedures. > > > +(define (is-value-right-type? var list-of-procedures record > > > fieldname) > > > +=C2=A0 (if (null? list-of-procedures) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #f > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if ((car list-of-procedures) var) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #t > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (is-value-rig= ht-type? var (cdr list-of-procedures) > > > record > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fieldname)))) > > Alternatively, (any (cut <> var) list-of-procedures). >=20 > You mentioned that in the last review, I just can't figure out how to > use your > suggestion. This is the code that I have in the task list WIP: >=20 > *** TODO simplify my sanitizing funcions=C2=A0 (any (cut <> var)) >=20 > #+BEGIN_SRC scheme > (use-modules (ice-9 curried-definitions) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = (srfi srfi-26)) >=20 > (define (((expect-any predicates) record field) var) > =C2=A0 (if (any (cut <> var) predicates) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 var > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (begin > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; code code code > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; how do I tell the user whic= h function failed? > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (display "error") > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (throw 'bad! var)))) All of them failed, that's the point. As for constructing a string from a list of procedures, see list-of-procedures->string. > ;; here is how you use it. > =C2=A0 (name opensmtpd-table-name ;; string > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (default #f) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (sanitize (lambda (var) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((expect-any (list string? numb= er?)) "hello" > "that") var)))) >=20 > #+END_SRC >=20 > Does that look close to what you want? I feel like it is way off, but > I don't know. Honestly when I say this suggestion I was completely > blown away, I have been using (any ) and (every) in a few places to > get rid of some uses of primitive eval. I don't see that, but I do see functions that have been dropped still mentioned in the ChangeLog. Another hint at this patch being too convoluted for its own sake ;) > > This procedure needs a proper name, like sanitize/check-type, but > > more importantly, why not simply use define-configuration? >=20 > Yes! I have slowly been realizing that I have been clumsily re- > inventing define-configuration. I hope to switch to define- > configuration, because a lot of this code would go away. But I need > to explore how define-configuration works. > That would be quite a major change. :) Manchmal erspart einem monatelange Implementier-Arbeit einen Nachmittag in der B=C3=BCcherei. Cheers [1] https://issues.guix.gnu.org/issue/56046#4-lineno323