unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54713] [PATCH] gnu: linux: Allow kconfig options to be strings
@ 2022-04-04 18:26 antlers
  2022-04-05 18:18 ` bug#54713: " Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: antlers @ 2022-04-04 18:26 UTC (permalink / raw)
  To: 54713; +Cc: antlers

* 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(-)

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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#54713: [PATCH] gnu: linux: Allow kconfig options to be strings
  2022-04-04 18:26 [bug#54713] [PATCH] gnu: linux: Allow kconfig options to be strings antlers
@ 2022-04-05 18:18 ` Ludovic Courtès
       [not found]   ` <CAFxNT+fo7wzFBnotiCBYC9Lpwae7VacVErUoRo5ToxdUf4gpVA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2022-04-05 18:18 UTC (permalink / raw)
  To: antlers; +Cc: 54713-done

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’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#54713] Fwd: bug#54713: [PATCH] gnu: linux: Allow kconfig options to be strings
       [not found]   ` <CAFxNT+fo7wzFBnotiCBYC9Lpwae7VacVErUoRo5ToxdUf4gpVA@mail.gmail.com>
@ 2022-04-06 21:30     ` Elijah Harding
  0 siblings, 0 replies; 3+ messages in thread
From: Elijah Harding @ 2022-04-06 21:30 UTC (permalink / raw)
  To: 54713-done

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’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-06 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 18:26 [bug#54713] [PATCH] gnu: linux: Allow kconfig options to be strings antlers
2022-04-05 18:18 ` bug#54713: " Ludovic Courtès
     [not found]   ` <CAFxNT+fo7wzFBnotiCBYC9Lpwae7VacVErUoRo5ToxdUf4gpVA@mail.gmail.com>
2022-04-06 21:30     ` [bug#54713] Fwd: " Elijah Harding

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).