From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MGNCNK+RU2LxfwAAgWs5BA (envelope-from ) for ; Mon, 11 Apr 2022 04:25:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0DmcMa+RU2JsBgEA9RJhRA (envelope-from ) for ; Mon, 11 Apr 2022 04:25:51 +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 699B837E9D for ; Mon, 11 Apr 2022 04:25:51 +0200 (CEST) Received: from localhost ([::1]:54948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndjkS-0005p5-8w for larch@yhetil.org; Sun, 10 Apr 2022 22:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndjk7-0005oO-Bg for guix-patches@gnu.org; Sun, 10 Apr 2022 22:25:27 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48127) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ndjjj-0000oe-0F for guix-patches@gnu.org; Sun, 10 Apr 2022 22:25:26 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ndjji-0005Tv-R1 for guix-patches@gnu.org; Sun, 10 Apr 2022 22:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54846] [PATCH] gnu: linux: Escape the values of string-type kconfig options Resent-From: antlers Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 11 Apr 2022 02:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54846 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54846@debbugs.gnu.org Cc: antlers X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164964389121049 (code B ref -1); Mon, 11 Apr 2022 02:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Apr 2022 02:24:51 +0000 Received: from localhost ([127.0.0.1]:42024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ndjjX-0005TR-HG for submit@debbugs.gnu.org; Sun, 10 Apr 2022 22:24:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:42452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ndjjV-0005TJ-PG for submit@debbugs.gnu.org; Sun, 10 Apr 2022 22:24:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndjjV-0005iF-E5 for guix-patches@gnu.org; Sun, 10 Apr 2022 22:24:49 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:52151) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ndjjT-0000ji-Qd for guix-patches@gnu.org; Sun, 10 Apr 2022 22:24:49 -0400 Received: by mail-pj1-x1034.google.com with SMTP id bg24so1441717pjb.1 for ; Sun, 10 Apr 2022 19:24:27 -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=Oom+QP5LNVAGwFpKdZ0H6N8Ai8LljNt2dQbzziiAxwQ=; b=FbljAGSFV6xdroZB2Xoi5M+cq/k+JjGKNN0YO4gf1rMx1zydQWoptBlFZZu5XYjrwD s0ce71YBcv43FXHHRL6fsNLbNjm97dhfP8JqPUfvQJgf3fDxMpVSi4KsNXUNGCp+zhal uggxDMMjMQeM03iZyMRpAt47X3oiKCSQCO9rgsShdo9DU+gr9ph6rRRGXOn6ePK/3mQe Dfgd6ELJE7Z1lOT0FdyXg7kN7T7zUnAAVW1huUG94X2M+6C/5jyVXuzcUZuim6EAuBp6 fOVuYu72nP/t4Ssts3gfcBM/9ofQNuRF24R6k6IT+y0SSgEW1CfzIdl/38edx9PBpLd2 dF/Q== 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=Oom+QP5LNVAGwFpKdZ0H6N8Ai8LljNt2dQbzziiAxwQ=; b=aC5xY006V/cRMtcNrX9BIyuRIq5DLTDbp6fvGpr6WRIeZUYGaiQ0kl/g1nZeWNrCW1 Skvl/xJ+udfJgsH4PvrhPJ3Jgh7nGQg0N9ahLClxsELmwxKZrTzy6+Cu7ZiqbXL6d9DC mamO2N/a5wQml0FfmjYPNnpKUQRFMN7dbiSkv1vGQ9Ql1/rBAODJfZR7lV9JxG9bsJCI MSMxRC0tlPSueQ7xXzNLxT4FqgZs2jRVOwiJC63NGlmB++dIOSRE0ueFriEUGyv/jOdR dppkMbDWPfwNeOUnFwTVv78QLzpoVPl+1AIvSbQCaLVAiB1nAyPPuzVhy/bWSYBrjyXq kucw== X-Gm-Message-State: AOAM532x1B1+IOspNt/gzVODZdVr4jXmodpflDqcpag3MyzU4xoHny98 PXRwyPHI90V7yw77Ab/nkmouPwVC73cN2A== X-Google-Smtp-Source: ABdhPJx+jzrG/4N1QYZIFS6GMQQEzLSnAr15DR+ytdgxeISZrkANuAVTHBkVCdBUjqUrk1EwhCSMzw== X-Received: by 2002:a17:90a:4403:b0:1ca:a4a3:6824 with SMTP id s3-20020a17090a440300b001caa4a36824mr33907973pjg.20.1649643866267; Sun, 10 Apr 2022 19:24:26 -0700 (PDT) Received: from tower.hitronhub.home (24-113-171-200.wavecable.com. [24.113.171.200]) by smtp.gmail.com with ESMTPSA id k62-20020a17090a4cc400b001c7ea7f487asm18774475pjh.39.2022.04.10.19.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 19:24:25 -0700 (PDT) From: antlers Date: Sun, 10 Apr 2022 19:24:10 -0700 Message-Id: <20220411022410.5606-1-autumnalantlers@gmail.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=autumnalantlers@gmail.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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=1649643951; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Oom+QP5LNVAGwFpKdZ0H6N8Ai8LljNt2dQbzziiAxwQ=; b=jSafKLQjVJtcOFP4akjx63l3TI8ETZDCct4J0DrOIniAZzGQrR1eljpl+WOpdj2epnvPCs cYrOdFjp2WmyksLS1IRts+o8UyZEtQ5FJpj+PNN0beox3EzUVVv3yIPGq9dgpCq5uxcgHs OuKAnQ29A2Shwgr7XlWaV+z1qf70uizgArGNidXy+hlb9PoFDI9+HS7wsO6poM/F7uGRD9 G+MwZuoay+T/eBsPLgw76BcbjLh3dCN+PDj2RaMTy8Dif5UewYJ8z+Mt8lri9W54HedfGM cfjjSdu87d9xxSY6dOIvseyHwPbsRmki/yDn86vSPR3G3Raf+M7umuFRQwwv0w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649643951; a=rsa-sha256; cv=none; b=isGHH4O/3KuCIjoqr+t0QJIomwgAku43tXYTD5UUJipCIkQd/oZzzBVdla4WpjL5WTnem8 a/OszOB+0QOVwjHH/dfgQcQPtx/3jTbWJuRkNxa3ZpNTzKlmWg6jWFYY5vbpPAKnlyOQJ0 oL7pzsc/+0qllo3pYfP/PYW5e4DsERNvG3KciAXYwxgH6Ys9zdko/WUbKpdE8tgopLPR27 rwt/NRj8shXb3TGXMiW4ViolU88k3ILD4Gymn8/axiLLhaRydpW2KacBm/aivwaWscMWI2 r8ue4zDvdXwwddVWtNBxYg+cPdZx336ucvURGTilKeqUkHg+edDGbIWoNPBVvw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=FbljAGSF; 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.73 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=FbljAGSF; 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: 699B837E9D X-Spam-Score: 6.73 X-Migadu-Scanner: scn0.migadu.com X-TUID: uuXm/rrrTK+Y * 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. --- gnu/packages/linux.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index b31fe0a580..60ae668fd9 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -761,6 +761,22 @@ (define %bpf-extra-linux-options ("CONFIG_IKHEADERS" . #t))) (define (config->string options) + (define (escape-string str) + "Returns STR with the escapes necessary to be read as a string-type + option's value. Handles characters within the set (char-set-intersection + char-set:ascii char-set:printing), removing those which are known to be + unsupported." + (fold (match-lambda* (((match? fmt) str) + (transform-string str match? + (cut format #f fmt <>)))) + str + `((#\# "") ; No known way to escape # characters. + (#\$ "$~a") + ("\"\\'`" "\\~a") + (";:()#" "\\\\~a") + ("|" "\\\\\\~a") + ;; No support for tabs, newlines, etc. + (,(char-set->string (ucs-range->char-set 9 14)) "")))) (string-join (map (match-lambda ((option . 'm) (string-append option "=m")) @@ -769,7 +785,9 @@ (define (config->string options) ((option . #f) (string-append option "=n")) ((option . string) - (string-append option "=\"" string "\""))) + (string-append option "=\"" + (escape-string string) + "\""))) options) "\n")) -- 2.34.0