GNU bug report logs - #54713
[PATCH] gnu: linux: Allow kconfig options to be strings

Previous Next

Package: guix-patches;

Reported by: antlers <autumnalantlers <at> gmail.com>

Date: Mon, 4 Apr 2022 18:54:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54713 in the body.
You can then email your comments to 54713 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#54713; Package guix-patches. (Mon, 04 Apr 2022 18:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to antlers <autumnalantlers <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 04 Apr 2022 18:54:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: antlers <autumnalantlers <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: antlers <autumnalantlers <at> gmail.com>
Subject: [PATCH] gnu: linux: Allow kconfig options to be strings
Date: Mon,  4 Apr 2022 11:26:09 -0700
* 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 <at> denx.de/

Apologies to those with double-quotes or backslashes in their
CONFIG_SYSTEM_*_KEYS.

Signed-off-by: antlers <autumnalantlers <at> gmail.com>
---
 gnu/packages/linux.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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"))
 
-- 
2.34.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 05 Apr 2022 18:20:02 GMT) Full text and rfc822 format available.

Notification sent to antlers <autumnalantlers <at> gmail.com>:
bug acknowledged by developer. (Tue, 05 Apr 2022 18:20:02 GMT) Full text and rfc822 format available.

Message #10 received at 54713-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: antlers <autumnalantlers <at> gmail.com>
Cc: 54713-done <at> debbugs.gnu.org
Subject: Re: bug#54713: [PATCH] gnu: linux: Allow kconfig options to be strings
Date: Tue, 05 Apr 2022 20:18:38 +0200
Hi,

antlers <autumnalantlers <at> 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 <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#54713; Package guix-patches. (Wed, 06 Apr 2022 21:40:02 GMT) Full text and rfc822 format available.

Message #13 received at 54713-done <at> debbugs.gnu.org (full text, mbox):

From: Elijah Harding <autumnalantlers <at> gmail.com>
To: 54713-done <at> debbugs.gnu.org
Subject: Fwd: bug#54713: [PATCH] gnu: linux: Allow kconfig options to be
 strings
Date: Wed, 6 Apr 2022 14:30:01 -0700
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 <at> gnu.org> wrote:
>
> Hi,
>
> antlers <autumnalantlers <at> 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 <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#54713; Package guix-patches. (Mon, 11 Apr 2022 05:09:02 GMT) Full text and rfc822 format available.

Message #16 received at 54713 <at> debbugs.gnu.org (full text, mbox):

From: Elijah Harding <autumnalantlers <at> gmail.com>
To: 54713 <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: linux: Escape the values of string-type kconfig
 options
Date: Sun, 10 Apr 2022 22:08:20 -0700
Oh lord, hold off on this one: File paths in CONFIG_SYSTEM_*_KEYS
options are parsed by Make before their file is opened, but
CONFIG_LOCALVERSION strings aren't, nor are (I imagine?)
CONFIG_INITRAMFS_SOURCE's despite also being file paths, so taking
responsibility for escaping means handling several options
individually :/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 May 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.