From mboxrd@z Thu Jan 1 00:00:00 1970 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 5A78BC433F5 for ; Tue, 19 Oct 2021 14:25:45 +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 B5D2361029 for ; Tue, 19 Oct 2021 14:25:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B5D2361029 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com 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 9D663829FC; Tue, 19 Oct 2021 16:25:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="gBKQgfea"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75DE582DB4; Tue, 19 Oct 2021 16:25:41 +0200 (CEST) Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D9BE181725 for ; Tue, 19 Oct 2021 16:25:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf2c.google.com with SMTP id v2so28953qve.11 for ; Tue, 19 Oct 2021 07:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0LqTZCYJC41R/BRtJ1V1JJK/FEOqbIz/mVbagTnVU0Q=; b=gBKQgfeaNoY+ye9LrQI5gxqmKMvzS46yOKgIu8nTkZ3oUANbBfFBTVDkr2FG5x9s/Z BuEygPESMnySwWzwwDe3I5ZLXmrFtiRh3yCt5vbjL11UQ/rclLk+FC9yHvecXBv4o+xj UmgeDJBkA69qdBwUhmYjrxSbh+tAGzQC2wOqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0LqTZCYJC41R/BRtJ1V1JJK/FEOqbIz/mVbagTnVU0Q=; b=RR9TN97BPTE+huLDtgaplSMhtcrJ3Aur/VDV8SB9HGLQBXVRnJ4Hm+d4smO0a5XB/U C6ugn8avNyOZcNP/upjSylkV6cu+G4UGBNxbHe93v2tLUth6ht4CCDVqM1rElZLP2Y2X y3LsimSART8X/YqOC1FB7BVAnhhdhQUDiO87N+1Gt5c/Zsg/9u4D8WunQARQiWsoOdHQ MHUye0hHwuG1PA0VNi/eqR7TBymIHsU7cDywMV5l3d+wqYcwRfd421P4ENhjiqqRTKE0 8QcWLQN09cNoKeIMhihOtFN84sRH9RvNBt5kAWydfkshcfiKLlCLRJUFCcbFZj4Oqida SYzA== X-Gm-Message-State: AOAM5311j7x6vdaAzAadmePmJJOmBbMcGPfY96idWViAbqT0lcBaFhfd 1L1+3tqwaBoZXKdYQbdmbMSpEQ== X-Google-Smtp-Source: ABdhPJw4qv2UxGwesMOwdeKsSr2cvTUJet+4FrYwaCgt8ovS67aeWKNUZ3xgc0k7mgUNry8yf30H2Q== X-Received: by 2002:ad4:4993:: with SMTP id t19mr115543qvx.38.1634653532350; Tue, 19 Oct 2021 07:25:32 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-b5ac-d4ae-96e7-5d3d.res6.spectrum.com. [2603:6081:7b01:cbda:b5ac:d4ae:96e7:5d3d]) by smtp.gmail.com with ESMTPSA id bi17sm2944139qkb.115.2021.10.19.07.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 07:25:31 -0700 (PDT) Date: Tue, 19 Oct 2021 10:25:29 -0400 From: Tom Rini To: Simon Glass Cc: U-Boot Mailing List , Rasmus Villemoes , Heinrich Schuchardt , Wolfgang Denk , Joe Hershberger Subject: Re: [PATCH v8 4/8] env: Allow U-Boot scripts to be placed in a .env file Message-ID: <20211019142529.GE7964@bill-the-cat> References: <20211018181322.1181847-1-sjg@chromium.org> <20211018121315.v8.4.Ie78bfbfca0d01d9cba501e127f446ec48e1f7afe@changeid> <20211019140711.GC7964@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="YVdDGsaWGKDJFGpV" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett 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 --YVdDGsaWGKDJFGpV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 19, 2021 at 08:11:08AM -0600, Simon Glass wrote: > Hi Tom, >=20 > On Tue, 19 Oct 2021 at 08:07, Tom Rini wrote: > > > > On Mon, Oct 18, 2021 at 12:13:18PM -0600, Simon Glass wrote: > > > > > At present U-Boot environment variables, and thus scripts, are defined > > > by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of t= ext > > > to this file and dealing with quoting and newlines is harder than it > > > should be. It would be better if we could just type the script into a > > > text file and have it included by U-Boot. > > > > > > Add a feature that brings in a .env file associated with the board > > > config, if present. To use it, create a file in a board/ > > > directory, typically called .env and controlled by the > > > CONFIG_ENV_SOURCE_FILE option. > > > > > > The environment variables should be of the form "var=3Dvalue". Values= can > > > extend to multiple lines. See the README under 'Environment Variables= :' > > > for more information and an example. Note that environment variables = may > > > not end in + but can start with other strange characters, including > > > underscore, comma and slash. > > > > > > In many cases environment variables need access to the U-Boot CONFIG > > > variables to select different options. Enable this so that the enviro= nment > > > scripts can be as useful as the ones currently in the board config fi= les. > > > This uses the C preprocessor, means that comments can be included in = the > > > environment using /* ... */ > > > > > > Also support +=3D to allow variables to be appended to. This is neede= d when > > > using the preprocessor. > > > > > > Signed-off-by: Simon Glass > > > > As much as I and others appreciate that you've written the parser here > > in a classic UNIX tool, awk, since a lot of the problems also seem to > > stem from having the parser be able to handle previously valid > > environment variables, if this was written in Python say, would we have > > this problem? >=20 > Well ideally I'd like to avoid Python in this case as it is in the > compilation path. I am not sure yet what Wolfgang actually wants, > apart from variable names ending with + which I would like to > disallow. >=20 > So if we can clearly understand the goal, then we might be able to do > it in awk, but, again, can we just disallow '+' in var names ? If we say that everything that's valid in the environment today needs to continue to be valid, so that includes '+' and only disallowing '=3D' and NUL as Wolfgang has said, can you update the awk parser to handle it? --=20 Tom --YVdDGsaWGKDJFGpV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFu1VkACgkQFHw5/5Y0 tyyK5wv/QFQLC60beZN7pVSxD7TDlan4/0ZDuduYakIk4pAM4nZ3s3Ck3DXIe0dW OSCm/rtWB2Wgr9cA9et8zNS62tjmoir5tMwvGovDJmlPUQt0FJ5eO2KCN70D9zLa 4WEWi2V5essmtXZIgT8Y15scPZ16DosfLsmQInw4LEQl7SXrU3XCejxQ7NbLka+W voPei96Wh7s8cDmBHUjoT8qq9dvbsFnzEm16lhl3VgRUxRRUTYjpmf6uOmezpzGD qyXi3C1okhE+51Nf7v30LD7Tn4K/89o2r/BaVpRQR8XyCYyoIPdMKqGEHXjbZpaU KkpVsipDv5ZiEA1jw5KQffSDEv7mKPPOYwnA2oRxARWMVKqJjP6qBDT30phT4mEn I7puDwoD3fb1/DfDw693OuZrWQPT2b/h3FTQuk/fsAdbsmZsL2EfkjwrehXMity1 D5YEc+Erob4pEDVXDCvKUEivK7qGDsjCkKf3OVzkPgzWo/FAYnIyQBkHZP68RzJA apnZ6Rz0 =L8Fx -----END PGP SIGNATURE----- --YVdDGsaWGKDJFGpV--