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 SDIrBVT3amL5NAEAbAwnHQ (envelope-from ) for ; Thu, 28 Apr 2022 22:21:40 +0200 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 iMZWBVT3amJaewEA9RJhRA (envelope-from ) for ; Thu, 28 Apr 2022 22:21:40 +0200 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 9BFDE3D8D8 for ; Thu, 28 Apr 2022 22:21:39 +0200 (CEST) Received: from localhost ([::1]:54756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkAdu-0006nz-6L for larch@yhetil.org; Thu, 28 Apr 2022 16:21:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkAbQ-0005Nj-HE for guix-patches@gnu.org; Thu, 28 Apr 2022 16:19:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nkAbN-0005nb-TY for guix-patches@gnu.org; Thu, 28 Apr 2022 16:19:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nkAbN-00068o-Pr for guix-patches@gnu.org; Thu, 28 Apr 2022 16:19:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54846] [PATCH] gnu: linux: Escape the values of string-type kconfig options References: <20220411022410.5606-1-autumnalantlers@gmail.com> In-Reply-To: <20220411022410.5606-1-autumnalantlers@gmail.com> Resent-From: Antlers Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Apr 2022 20:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54846 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo patch To: 54846@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 54846-submit@debbugs.gnu.org id=B54846.165117709623550 (code B ref 54846); Thu, 28 Apr 2022 20:19:01 +0000 Received: (at 54846) by debbugs.gnu.org; 28 Apr 2022 20:18:16 +0000 Received: from localhost ([127.0.0.1]:50072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkAad-00067m-Kv for submit@debbugs.gnu.org; Thu, 28 Apr 2022 16:18:15 -0400 Received: from mail-oi1-f180.google.com ([209.85.167.180]:43780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkAac-00067Y-Ow for 54846@debbugs.gnu.org; Thu, 28 Apr 2022 16:18:15 -0400 Received: by mail-oi1-f180.google.com with SMTP id v65so6508275oig.10 for <54846@debbugs.gnu.org>; Thu, 28 Apr 2022 13:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:subject:mime-version :content-transfer-encoding; bh=JMFsOMO9b+5LJPjrj+Yo42xzOktnaN47jUOLxS6n1Dw=; b=d2bSmzM0qFz0dH50QcQgXfsvVstYyPglRni85HaP4u9Vc+grFERfSuhAVgeuumHXXj atnU+6PakCfcDwEJipwTCZx4pABD79zY+N4JTLtchquNWHbKd2H07B6rXOI30CAJcM+k v8fZoSBaxTvHPjnu9TVQPOwbrkjGE4j0lEs5RwWhS0Kh87JRuXNYYpVvsXKjvB0PXyJe 1CJnjVMvhMiG0kGGGHNG4CAPdqInC3nHapXx1G4vKaQxeQ0/Ik1ww7i9G0YPzQrnqptS jtr7QDX8VdJQQ+sM0+SYIUKKwPPrbOJXOWV678Sv0bAr2TMMiLni6M8bJezAw1/fdFMA 8b3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:message-id:subject:mime-version :content-transfer-encoding; bh=JMFsOMO9b+5LJPjrj+Yo42xzOktnaN47jUOLxS6n1Dw=; b=phXxqecyK0TEht/ZyWcRzcTQzfmIoz0qGlZ2M5TP4PtpUSx2WJvQ7kxtRtBocSSuZg /EmATnYyvGMlFmXVy9Cl3KSk5dzUCsXZ/NiHir7F1L5JI5Qh+zOtt24iVOJkOJyWh8cg lbvK8p/GR2J02tszdG+pOyKdZFauwSvCxyreVvH/7X71sFLJ8I84vLk5QQ6WYCOyv6ob mrt/txtw6wm/0C5z1eutCwcuUis0DFw19evQV+BsMYYRFtOsMShAZmNiYLBHwuaDM/af mCOEhqgnsmQtYaOwEi9YV68xPP6BEn9D7PV71RL7jqho8vGRFTfmxAK+g5JYt73tidAT rRsg== X-Gm-Message-State: AOAM53071cPDYdI5eKS7TeKlbHaR0gDiKXvZnq8qZU6MhxLA0AccTwqB uNHiivnjlINmLivb7n0U4zj7nfHw95M= X-Google-Smtp-Source: ABdhPJzsJYNRQEbP7gf4elmr9G9IixPdSIQ7Z6VfXeZuk85Xel3Z2uwfN44fUYgd3G9PC8s23ReiMg== X-Received: by 2002:a05:6808:1644:b0:2f7:4de5:3c53 with SMTP id az4-20020a056808164400b002f74de53c53mr21020930oib.225.1651177088782; Thu, 28 Apr 2022 13:18:08 -0700 (PDT) Received: from [127.0.0.1] ([70.39.121.42]) by smtp.gmail.com with ESMTPSA id q4-20020a4a3004000000b0035e974ec923sm415422oof.2.2022.04.28.13.18.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2022 13:18:08 -0700 (PDT) Date: Thu, 28 Apr 2022 20:18:04 +0000 (UTC) From: Antlers Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651177299; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=JMFsOMO9b+5LJPjrj+Yo42xzOktnaN47jUOLxS6n1Dw=; b=hSV+OOpjCbZel5Or7DVOm5mFPraVGyk6js8Azo4O8WfQXjNqQJYVlOO9sNUA5yM1LD96hz DKlimhfq5hJ9jfAz6A7jV/fe8TnMKKQGkhOgPf/477VpcYqC8Gx043VSUolTYGBQdYW/// 3wlOivfBD3AM6CS8qVVJoMXw+U73w9ak1ZCD79wsXP5qcnrr0/U+Ika2JrfDJpnNeBzWxe iqkagCPelYzZVpKzAzMcf0IJKoGXoPbK65/CppI/sxGy3kefxFTiFo8Hk7uBlRihieBqL1 HsLn6yT3C2M3Wjeohr6wGjce16o5MwLn2PchhYRgP9ilI46oU0zMWGCnoKMMVg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651177299; a=rsa-sha256; cv=none; b=aE1k9RXDt/k+I0xMoxF5waenuTLrIc2c11uffnec2D3lNvh241MgIRCBDJACOrMv544+fe iJRC53hCyBhPTXxR7TEGODyc7u39OY90QyTFZt6Lq6cYaDUJcQWu3M/YbrgVlBzKC8OD7P nossbRV9e7aanymYDmxtvfskWqNj/8vxmae/KLgmLa2rBjBSh4LdesQoyvrKmlkNGYq5XZ KvWYCN9dzA+gPaavFmA7VMyEJSTLcqagmLgyPO5YE4SYgtVEmOLUbujyZjCvUHXLr4zOCx HU0VIEtYf2MY5AeKd0uaG/ZqFrn/ZNXmLORWTIStYiPo6ryc0+pmu93bUNibSQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=d2bSmzM0; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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" X-Migadu-Spam-Score: 6.00 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=d2bSmzM0; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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" X-Migadu-Queue-Id: 9BFDE3D8D8 X-Spam-Score: 6.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: 0MpEyFWB3lvS Yeah, sorry for the silence, there's been a lot going on and being able to = use strings in the first place is a comportable baseline of functionality- = I don't feel that one should implement implicit escaping of a field until c= onfident that all the corner cases are handled, and think that there are so= me subtle warts left. Haven't had that time iron those out, but I'll be gla= d to polish the details and can follow up within about a week once I've add= ressed my remaining cornerns about correctness. Thanks for bearing with me = I fumble my way through the conventions of the mailing list and formatting,= nitpicks are what I'm here for c: I think transform-string is a gem for the task, the inputs are flexible and= the author specifically cites better performance than string-fold in the (= ice-9 texinfo) source, but I appreciate your point and can happily speciali= ze it in-line. ---------------------------------------- Apr 28, 2022 5:16:46 AM Ludovic Court=C3=A8s : > Hi antlers, > > Did you have a chance to look into it? > > TIA, > Ludo=E2=80=99. > > Ludovic Court=C3=A8s skribis: > >> Hi, >> >> antlers skribis: >> >>> * gnu/packages/linux.scm (config->string): add escape-string >>> >>> Handles characters within the set >>> (char-set-intersection char-set:ascii char-set:printing), removing >>> those which are known to be unsupported. >> >> [...] >> >>> (define (config->string options) >>> +=C2=A0 (define (escape-string str) >>> +=C2=A0=C2=A0=C2=A0 "Returns STR with the escapes necessary to be read = as a string-type >>> +=C2=A0=C2=A0=C2=A0 option's value. Handles characters within the set (= char-set-intersection >>> +=C2=A0=C2=A0=C2=A0 char-set:ascii char-set:printing), removing those w= hich are known to be >>> +=C2=A0=C2=A0=C2=A0 unsupported." >> >> Nitpick: You can turn the docstring into a comment since the docstring >> wouldn=E2=80=99t be accessible anyway. >> >>> +=C2=A0=C2=A0=C2=A0 (fold (match-lambda* (((match? fmt) str) >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (transform-string str match? >>> +=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 (cut format= #f fmt <>)))) >> >> Please avoid tabs. >> >> =E2=80=98transform-string=E2=80=99 is from (texinfo string-utils), which= is not imported >> here.=C2=A0 IMO, we=E2=80=99d rather avoid depending on this module sinc= e it=E2=80=99s really >> designed for the Texinfo machinery. >> >>> +=C2=A0=C2=A0=C2=A0=C2=A0 str >>> +=C2=A0=C2=A0=C2=A0=C2=A0 `((#\# "") ; No known way to escape # charact= ers. >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (#\$ "$~a") >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("\"\\'`" "\\~a") >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (";:()#" "\\\\~a") >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("|" "\\\\\\~a") >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; No support for tabs, newlines,= etc. >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (,(char-set->string (ucs-range->c= har-set 9 14)) "")))) >> >> I wonder if this should be implemented in terms of =E2=80=98string-fold= =E2=80=99 >> instead: >> >> =C2=A0 (string-concatenate-reverse >> =C2=A0=C2=A0=C2=A0 (string-fold (lambda (chr result) >> =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 (match chr >> =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 (#\# (cons "" result)) >> =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 ;; =E2=80=A6 >> =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 (_ (cons (string chr) resu= lt)))) >> =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=C2=A0 str)) >> >> Thoughts? >> >> Thanks, >> Ludo=E2=80=99.