Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABDF9C433F5 for ; Mon, 25 Oct 2021 07:06:56 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF56461002 for ; Mon, 25 Oct 2021 07:06:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EF56461002 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=prevas.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 397C7834AA; Mon, 25 Oct 2021 09:06:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="bW8SfV9t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 201428344D; Mon, 25 Oct 2021 09:06:52 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20721.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::721]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8B9CE834CD for ; Mon, 25 Oct 2021 09:06:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AveduuDe/hkuJnyzilj3Pl6S1ZlvzUgIaDMdfgbEXSYUZSf/dslkcp58LGVBPCDnY6pOEfja1yCm/PmvILeWRVh9+LdGJdm76KH7jrVfm2+8+RGgU72Uf7X/KaHqTN5y1xu+BigUdq87Y8GtytDLkUIoyoSx9hdcGaO9Uzxbzc4aYOYC02mWX2WIOSv3Lli0bMUbpeHm7zV/INA18idzlE3RNvYbVdClqQZ15j/wFcc9XElZCqgFub1HYUQHj2AGwVa7RfnwogzyPBhpIZcTjx3Fj/FGmUD2vP1GpUDkEuM/9oHyV21+5eDAzeKmpLV16Pq/bvsk5Qw9+uz6nH20uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IoG265t/517VXj3LvZCds7vQTSmgFp926ZZxuhc/ubI=; b=bHYEoULwawkU6J7yRXeZWKtCaPPsVLsfzV3ol3SQqagMrTKGUiQeD6UiLhMAKwP8HhnnBYEAB6WU0I/pYMjfxFE74/SGZh9ZkqJm30bwqyydz1jmTRGXndpsJS7Io5XghbYJARwPo990U7qOuRh7oD5cYfmO1YY/40fchDHq2iEYkfLLAga9Q1ttQu4SgGZ0V7HaWXxaJrN8o9CQcqk2Jm23KJStUbF9D9RZiQxBx/m4ba4mFQRxG/csxrrLUvg/7+4hvRMZI0Htnh12mZf7ezQ24S/G7OmqlgwbDKy00K2AJiQWTuri9NbcFGkwDUWQHFN6f8bF76lE0dWRrFS0pg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IoG265t/517VXj3LvZCds7vQTSmgFp926ZZxuhc/ubI=; b=bW8SfV9tkuSSoBZf12dRITzxyTmbZFg2npNj+7COoYVF/75+LOk7qlSivBkOjZeAiq9lzX4pJEt6LfAuRjXqf6PNOAmJ5mMcUIuNch1nNpbCVyO8Sng+VThvBdB6FSpf/mclSyNK+u1Be0ZQWRWmrCcZ3qHgZjZUS8A/3nSrxOc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from HE1PR1001MB1355.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f5::16) by HE1PR10MB1548.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:7:57::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Mon, 25 Oct 2021 07:06:37 +0000 Received: from HE1PR1001MB1355.EURPRD10.PROD.OUTLOOK.COM ([fe80::1574:9b9b:be30:c18d]) by HE1PR1001MB1355.EURPRD10.PROD.OUTLOOK.COM ([fe80::1574:9b9b:be30:c18d%12]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 07:06:35 +0000 Subject: Re: [PATCH v9 3/7] env: Allow U-Boot scripts to be placed in a .env file To: Simon Glass Cc: Tom Rini , =?UTF-8?Q?Marek_Beh=c3=ban?= , Wolfgang Denk , U-Boot Mailing List , Heinrich Schuchardt , Joe Hershberger References: <20211019224422.1447059-1-sjg@chromium.org> <20211019164418.v9.3.Ie78bfbfca0d01d9cba501e127f446ec48e1f7afe@changeid> <3682215.1634809802@gemini.denx.de> <20211021122325.GX7964@bill-the-cat> <3695947.1634821611@gemini.denx.de> <20211021152537.441c37b9@thinkpad> <20211021152831.15524883@thinkpad> <20211021160311.GC3577824@bill-the-cat> <4a7d69cd-b4d0-779d-d3f3-2ddfc3e15d27@prevas.dk> From: Rasmus Villemoes Message-ID: Date: Mon, 25 Oct 2021 09:06:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: OL1P279CA0002.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:12::7) To HE1PR1001MB1355.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f5::16) MIME-Version: 1.0 Received: from [172.16.11.1] (81.216.59.226) by OL1P279CA0002.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:12::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.22 via Frontend Transport; Mon, 25 Oct 2021 07:06:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 593e6911-d3ff-450a-c276-08d99785fb81 X-MS-TrafficTypeDiagnostic: HE1PR10MB1548: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XXmQu857jB1u+ZKVQrd7+2cxFuo8+4RBQZ9rKhoU/2Gf+oaVEBXbeyxcLNQqSwuCHQe/gKw5CFNHM6Dv4I2iPUGXzPS5NefPZMyy7pihqCJG4UbLbdDk3U+ix/DqF8TVoyLdjKagDXO9CjGvpz94wNJ+eDeng45gfYuakriwxzM4X9oizdNUAs+gJfmiVTE4cp3YC4GSgCjtwdwdIOKOLQVuYrfuBQpWizVXzpCDnKh105wKdc9KWv/bS8YoMM1bfGneBQPk5kjkCXQePENGlH1RrcKUk2dJFTtc33dInnsapYVmnTDmJXA5tO9ajsLHx/nC5PF4TMt1fxk3CD1/YRfz34J4iFc45IFSHrSLIuk8ot0azL0gLvFnKZqTvfPpXfLey0Fc+ByoAvd40zXkFeX33ys1kRxySIAEuFa55UcFJhw4JXtWG0fqa78leNitj2IroCEwadKv+4FoJ0eS78SuNYOJOsfuTzUqV/Mfgt3ES28NW0sfs0kg3XrlHbJzcLccVWObyOwLb9NdoBjMsoy5UOprtYLzx+WJwNmEqogJBcNgK7hUZoBUuxHM2kTvKc62MznLe2y13pmkLDaUeC48IWOkGuq8tcDQmTgGh438BO4NuqAIp0kJ6eOoBlO2h36HiOTTrpxPdW7BETpX5l4bEf614MoV5Xg4JjQNP3XKx7NSx74jK7N9l9yKuhz/10kPEVWeA7BS185UWtCvtHjb6FX6gOx4HcStrVT7W+ZC8cckbwgp0vNnb2ehwDeMkpUrPOzUI4mA0D+lNYSNQB/WZPmcqpem8xZkCrjoYiA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR1001MB1355.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(366004)(52116002)(31686004)(316002)(86362001)(8976002)(36756003)(16576012)(8936002)(6486002)(83380400001)(66574015)(26005)(6916009)(8676002)(66556008)(44832011)(508600001)(4326008)(186003)(66946007)(54906003)(31696002)(66476007)(38350700002)(5660300002)(2906002)(956004)(38100700002)(2616005)(6666004)(142923001)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cXhwM0dzQks2WFJsSE5PUHdjNEZpeWY0N0t2WVMyTWk5TGpKUEdCQXlTV1Vy?= =?utf-8?B?ZFBmZ1lmZ1ZOTVRORklGNkd3Szg3S1BLbjhhMUxFZXY4MHNWd2lnKzlCUS85?= =?utf-8?B?VVNGNmtXWUJ4aDk3SXV6WU1qYmRVelFMY1BJY2pEVXQ3T3VYTVlnQXAzamRN?= =?utf-8?B?cG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cDgwV2NSM1R1WllP?= =?utf-8?B?SWJDQ3pBd2k1Mzh6Sy9RM0h3SVRna1BZQkJQWWRvRy95S2IrSnA3Kzg3OFUr?= =?utf-8?B?NlAyZzgwZ2V5K25DSUxma3c2Qm9qRzVweDhkbWFUcmV1ZkdhbG52WkdDMVZ4?= =?utf-8?B?Y2VkRUJFd3RjbGxIMXk5NjVybVM5QUZDYVRwMy8zUXlUNjNyMDBieFJGcEJV?= =?utf-8?B?VkJqRzFNbkJZTG1vVW5ITTZoNlN6Rk9QZE9hc2lJVjJuaVNZR2pBaEcrMTF1?= =?utf-8?B?ZHZ4NnlYS1RWbUxyd0F1MHI5QnBnPT0=?= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 593e6911-d3ff-450a-c276-08d99785fb81 X-MS-Exchange-CrossTenant-AuthSource: HE1PR1001MB1355.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 07:06:35.8014 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QHECobE6RloyKCqbVqKsw1vLm8CrByMUTuhkwx01JLhC0pq3t42w59Z3YBVHjngpBLxnC2BumyB6tn6lW1J2s2/KJYrHGb7ws6ruUsOrsiQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR10MB1548 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 24/10/2021 21.54, Simon Glass wrote: > Hi Rasmus, > > On Fri, 22 Oct 2021 at 00:41, Rasmus Villemoes > wrote: >> >> On 21/10/2021 18.03, Tom Rini wrote: >>> On Thu, Oct 21, 2021 at 09:59:38AM -0600, Simon Glass wrote: >>>> Hi Marek, >>>> >>>> On Thu, 21 Oct 2021 at 07:28, Marek BehĂșn wrote: >>>>> >>>>> On Thu, 21 Oct 2021 15:25:37 +0200 >>>>> Marek BehĂșn wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> On Thu, 21 Oct 2021 15:06:51 +0200 >>>>>> Wolfgang Denk wrote: >>>>>> >>>>>>> I confirm that '+=' looks better. But '+=" is technically broken. >>>>>> >>>>>> a bit of my opinion: >>>>>> I think =+ will confuse far more people than + as last character of var >>>>>> name working weirdly. But I also think that + should be supported as >>>>>> last character. Therefore I propose backslash escaping in variable name, >>>>>> i.e. >>>>>> var+=value >>>>>> appends value to var, while >>>>>> var\+=value >>>>>> sets variable with name "var+" >>>> >>>> My first preference is to disallow + at the end of an end var. Perhaps >>>> we can start printing a warning if people do it, for a few releases. >>>> >>>> My distance second preference is what Marek has here, using a >>>> backslash to escape the + character. >>> >>> How bad does it make the parser look if we allow trailing + in variable >>> names, by escaping them? It's seemingly the substantive objection at >>> this point. >>> >> >> So I don't understand all the bruhahaha around a + at the end of the >> varname. Nobody suggests (that I have seen) changing anything about how >> U-Boot at runtime interprets and handles variables, so all variable >> names that used to be valid continue to be so. >> >> It's just that this _new_ method of generating the environment places >> certain restrictions on what can be done. The old-fashioned ways >> (mkenvimage, good'ol CONFIG_ENV_EXTRA_SETTINGS with all its warts, and >> run-time 'env set') continue to allow people to define whatever env vars >> they want. This new method is meant for transitioning in-tree boards' >> default environment, and no in-tree boards need anything exotic. >> >> Also, completely independent of whether the subsequent parser is >> implemented in awk or python or rust, or what syntax it accepts and the >> semantics of that syntax, the fact that we first pass the input through >> cpp already means some things just won't work the same way as when given >> to mkenvimage, and that applies to both sides of the =: >> >> printf 'x/* huh */y=/* where did this go ? */\nmsg=I like unix\nfive >> spaces=5spaces\n' | gcc -E -P -x assembler-with-cpp - >> >> x y= >> msg=I like 1 >> five spaces=5spaces >> >> [In case its broken by the email, there are actually five spaces in the >> printf string between the words "five" and "spaces", the above should >> illustrate that cpp collapses those to a single space]. >> >> So, I'd much rather we do a cleaner break, and accept (and ignore) >> whitespace on either side of the assignment operator - that's how Make >> variable assignments work IIRC. And since a lot of people making use of >> this will already be familiar with Yocto, I think we should have two >> compound assignment operators, .= and +=. That still allows one to use >> any non-whitespace, non-= characters (modulo the restrictions imposed by >> the whole thing passing through cpp) in variable names, so >> >> foo+=abc >> >> means >> >> foo+ = abc >> >> while could append to foo by saying >> >> foo += abc >> >> That whitespace around the assignment operators would also make the >> input files somewhat more readable - there really is no point in having >> human-readable, human-editable text files having a format >> almost-but-not-quite be that of the on-disk format. > > I am OK with this on the name front, as I assume we don't want to > allow space in a var name! Exactly, there's really never any case where that would be sensible. But I would probably go a bit further and simply restrict varnames to the usual alphanumerics plus [_.+-] - in particular, exclude single and double quotes and backslash. That leaves the door open for somebody to later support "arbitrary" variable names by defining what it would mean to say e.g. "abc \n'\"\tfoo" = hahaha or whatever syntax they'd propose, but there's absolutely no point in implementing anything like that initially. > But how do I do this? > > bootargs=console=fred > #ifdef SOMETHING > bootargs+= dm-verity=... > #endif > > We need the space between the bootargs. Exactly like that, and for the case where you want to append something _without_ an extra space there's the .= operator I also suggested. FWIW, I like the idea that an indented line represents a continuation of the value of the current assignment. I don't think I've seen it addressed, but how do you deal with CONFIG_ string items? In the config.h file, the macro definition includes the double quotes, but I don't think one wants that in the env values. conf = CONFIG_DEFAULT_CONF bootcmd = bootm $loadaddr#$conf would attempt to boot e.g. 0x12340000#"foo", and while one can do de-quotification in U-Boot shell, it's rather cumbersome. Rasmus