Message ID | 20220404182609.14604-1-autumnalantlers@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 69B9227BBEA; Mon, 4 Apr 2022 21:47:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3EC3127BBE9 for <patchwork@mira.cbaines.net>; Mon, 4 Apr 2022 21:47:20 +0100 (BST) Received: from localhost ([::1]:53026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1nbTbb-000847-FW for patchwork@mira.cbaines.net; Mon, 04 Apr 2022 16:47:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nbRpy-0006Gi-0B for guix-patches@gnu.org; Mon, 04 Apr 2022 14:54:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nbRpx-0004OA-Nm for guix-patches@gnu.org; Mon, 04 Apr 2022 14:54:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nbRpx-000288-MO for guix-patches@gnu.org; Mon, 04 Apr 2022 14:54:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54713] [PATCH] gnu: linux: Allow kconfig options to be strings Resent-From: antlers <autumnalantlers@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Apr 2022 18:54:01 +0000 Resent-Message-ID: <handler.54713.B.16490983958052@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54713 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54713@debbugs.gnu.org Cc: antlers <autumnalantlers@gmail.com> X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16490983958052 (code B ref -1); Mon, 04 Apr 2022 18:54:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Apr 2022 18:53:15 +0000 Received: from localhost ([127.0.0.1]:52946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1nbRpD-00025o-L0 for submit@debbugs.gnu.org; Mon, 04 Apr 2022 14:53:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:59950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <autumnalantlers@gmail.com>) id 1nbRP7-0000qW-Qu for submit@debbugs.gnu.org; Mon, 04 Apr 2022 14:26:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <autumnalantlers@gmail.com>) id 1nbRP7-0004EW-Ki for guix-patches@gnu.org; Mon, 04 Apr 2022 14:26:17 -0400 Received: from [2607:f8b0:4864:20::629] (port=42867 helo=mail-pl1-x629.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <autumnalantlers@gmail.com>) id 1nbRP6-0000Hp-1j for guix-patches@gnu.org; Mon, 04 Apr 2022 14:26:17 -0400 Received: by mail-pl1-x629.google.com with SMTP id p17so8829100plo.9 for <guix-patches@gnu.org>; Mon, 04 Apr 2022 11:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DJK5MkEb+wLzhbzjGk8zVyW2RgHGcz8E0BkxrI26C/Q=; b=Mr7zpNO0SV8yRLJwHFRiI7B81kuGhzGrwHlQDfqdzFj9lBDpb3YU8V4yZ6La72jgtH 2S5x6JMcpZmfHXhWaKeUq5EM978oodQQQ8lKbeQLGPOKiXHzlhJwXOYOJPW2p6kvgeut CXIO2LZR4IWCq7Gar16sYnefHBz3QOPBGB9if3Bt5zO6FIC52x2UQ7QVHf0gcT03ctcZ 6IK3nJvV4OZxYB42Ch/eY8tYefAQpfkzvwL3WxT1tPaxEeqvbQsJwUK3r8eyZ+UBXkkj 7wLug6mcTcDs3JBuD4pFvIadzKvRMdTdf06wfGl6AqdUY1HAGDH8uJvfuk7+3a0mpges 1XeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DJK5MkEb+wLzhbzjGk8zVyW2RgHGcz8E0BkxrI26C/Q=; b=QHcrJOtfxlBUDr7uKi7iUPXAYN37olCPJE+gf9NZSMe3lKIfGJaO1oh6VIoCBnYySQ Qnuda7rk7lWoWtgHfg+E4Xy0YsiZ2fkkkdWTYaIv5o4SGx6pwazmv4SweBgk27HJ6snr oYEKjEhcOGpJXtxFIB2jd1Jk20C98S4YJCIKTFwnAz6FDqnt4D77Y2+JLClntVNd6YFq QnunDZQQZGEvIPwRW1KGssEI9V28uOCwAJH2Ijq439eTnCZKICF5oFe29jQ8nIyZo4Ae rg0a0VErzNd2Rwq0jVsMbYd/kgAYhOI9yOW/gTwstZYJ/BtlIXJBvKC3tAhef1R48pFx KjCg== X-Gm-Message-State: AOAM531wh67MutBRB0KXTfSrXHYjtJmdZ5E0N4wh8pgNU5swunAo0o8u JezUNxXQr8VqlXSLYcmXPk7qZYy+VsH4CQ== X-Google-Smtp-Source: ABdhPJz7aPOx1BKXBrUmiwiCSn/Dvgh4l76Juwhozb707/3vzleMWcz6MRoxfcFFAv2rM+uZrJU79Q== X-Received: by 2002:a17:90a:bb17:b0:1ca:b45d:eb39 with SMTP id u23-20020a17090abb1700b001cab45deb39mr495062pjr.57.1649096773938; Mon, 04 Apr 2022 11:26:13 -0700 (PDT) Received: from tower.hitronhub.home (24-113-171-200.wavecable.com. [24.113.171.200]) by smtp.gmail.com with ESMTPSA id g12-20020a056a001a0c00b004e1307b249csm13234076pfv.69.2022.04.04.11.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 11:26:13 -0700 (PDT) From: antlers <autumnalantlers@gmail.com> Date: Mon, 4 Apr 2022 11:26:09 -0700 Message-Id: <20220404182609.14604-1-autumnalantlers@gmail.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::629 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=autumnalantlers@gmail.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 04 Apr 2022 14:53:14 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Mon, 04 Apr 2022 16:47:12 -0400 X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#54713] gnu: linux: Allow kconfig options to be strings
|
|
Commit Message
antlers
April 4, 2022, 6:26 p.m. UTC
* gnu/packages/linux.scm (config->string): add a clause handling strings
Allows for the declarative configuration of kconfig options which accept
strings, such as CONFIG_MODULE_SIG_KEY.
I've enclosed the given string in quotes, but don't do any kind of
escaping. See the kernel mailing list for the current state of escaped
strings upstream:
https://patchwork.kernel.org/project/linux-kbuild/patch/1431003982-992-1-git-send-email-sr@denx.de/
Apologies to those with double-quotes or backslashes in their
CONFIG_SYSTEM_*_KEYS.
Signed-off-by: antlers <autumnalantlers@gmail.com>
---
gnu/packages/linux.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
Hi, antlers <autumnalantlers@gmail.com> skribis: > * gnu/packages/linux.scm (config->string): add a clause handling strings > > Allows for the declarative configuration of kconfig options which accept > strings, such as CONFIG_MODULE_SIG_KEY. > > I've enclosed the given string in quotes, but don't do any kind of > escaping. See the kernel mailing list for the current state of escaped > strings upstream: > > https://patchwork.kernel.org/project/linux-kbuild/patch/1431003982-992-1-git-send-email-sr@denx.de/ > > Apologies to those with double-quotes or backslashes in their > CONFIG_SYSTEM_*_KEYS. Applied. If needed, a cheap and often “good enough” way to escape strings is ‘object->string’: (display (object->string "foo\"bar\"baz")) => "foo\"bar\"baz" Would that help here? Thanks, Ludo’.
Without digging into kconfig to see exactly what's going on, I'm afraid that anyone using risky characters (especially ['`\n#$]) in one of these fields is on their own. Single-quoted strings appear to be interpreted as empty regardless of their content, so that's not an option. Within double-quoted strings, it doesn't appear to allow you to escape single-quotes, quisi-quotes, or #comments. While double-quotes and backslashes only need a single escape (which does line up with object->string), (semi-)colons need two, and a pipe only works with four ("\\\\\\\\|" in a guile source file). "$" breaks in ways that I frankly don't understand, and which no amount of escaping resolves. I'm perfectly content to assume that people will only use [a-zA-Z0-9/+-_. ], and [[\]!@%^&*()={},<>?] also happen to work just fine. Thanks for taking the time to review my patch, and for all the work you've done, within Guix and the broader Guile ecosystem alike. On Tue, Apr 5, 2022 at 11:18 AM Ludovic Courtès <ludo@gnu.org> wrote: > > Hi, > > antlers <autumnalantlers@gmail.com> skribis: > > > * gnu/packages/linux.scm (config->string): add a clause handling strings > > > > Allows for the declarative configuration of kconfig options which accept > > strings, such as CONFIG_MODULE_SIG_KEY. > > > > I've enclosed the given string in quotes, but don't do any kind of > > escaping. See the kernel mailing list for the current state of escaped > > strings upstream: > > > > https://patchwork.kernel.org/project/linux-kbuild/patch/1431003982-992-1-git-send-email-sr@denx.de/ > > > > Apologies to those with double-quotes or backslashes in their > > CONFIG_SYSTEM_*_KEYS. > > Applied. > > If needed, a cheap and often “good enough” way to escape strings is > ‘object->string’: > > (display (object->string "foo\"bar\"baz")) > => "foo\"bar\"baz" > > Would that help here? > > Thanks, > Ludo’.
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index ec68f5c57e..9a81fc4a3d 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -767,7 +767,9 @@ (define (config->string options) ((option . #t) (string-append option "=y")) ((option . #f) - (string-append option "=n"))) + (string-append option "=n")) + ((option . string) + (string-append option "=\"" string "\""))) options) "\n"))