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 9F655C433F5 for ; Fri, 22 Oct 2021 14:29:27 +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 1987A61205 for ; Fri, 22 Oct 2021 14:29:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1987A61205 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 0F1A58355C; Fri, 22 Oct 2021 16:29:24 +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="XjKONgRj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA6C78350D; Fri, 22 Oct 2021 16:29:20 +0200 (CEST) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (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 7C59F834E8 for ; Fri, 22 Oct 2021 16:29:16 +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-qk1-x733.google.com with SMTP id d205so4819708qke.3 for ; Fri, 22 Oct 2021 07:29:16 -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=PEVW5GKX43AeU5SgvzG7WKHRuZWXlqDD8IgB96Lt4rk=; b=XjKONgRjbgRXpWVARoquRCSYOkIiiNjVZ5BnIgOxZEfq//zknCwwqjIB/aX84K9TK1 zlPOAkEFuc6QPRIuG7qLgqJooihy+PaSRALS/qE805RMqPYiCRsTGMFsQvIsA2jUsfEz +WeDuvNkAg3xrrzw0SKNh2BAR2S/fMsFRLwbg= 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=PEVW5GKX43AeU5SgvzG7WKHRuZWXlqDD8IgB96Lt4rk=; b=Ol9/hxGumDwNHFzrdotgIFnwffUaXz2H6RRBhDrhwGsUfUgXAdKIcV1+voQaQxOCGb nwXDvW4HUmv15vu8W4fFQjzJln0HEyJpF+e36ZXysLLLWkniJTWSD5qgjhsAg8aSs6iE Rbiq0SDbLX2vBMLam/h79Z0MFduztts0QDllG0df/RjCnt5mfkdJWySt/8hZUSeh+3Np RS6RVWricrVpkYwWHDY/ebrMBs0wXZxtdg1i/StlLGxx+4C7HY0lxbfJLUdkzlSDKUA9 CCjwYAWF8gd3XCwWr20XxCJaxhhARFMak8G3xLWDJecVU809PKAGWNDfvQWfpRANQtVC PCtg== X-Gm-Message-State: AOAM533mJr6GymJgp7jHPsrsbrBdGIh24LBQprG6gnJG7VmKKWqfAPrZ cqP64YRahi+/EB5FNEICZlZGPg== X-Google-Smtp-Source: ABdhPJx97YLqpXvEWrsuxNzNGsLsLdl7jU60zKtyF3g+Egldkbq8i8YxU86MAANFL8qewDkP9MUkbQ== X-Received: by 2002:a05:620a:178b:: with SMTP id ay11mr289748qkb.287.1634912955072; Fri, 22 Oct 2021 07:29:15 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-f084-0129-62d8-869d.res6.spectrum.com. [2603:6081:7b01:cbda:f084:129:62d8:869d]) by smtp.gmail.com with ESMTPSA id v21sm4751337qtc.93.2021.10.22.07.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:29:14 -0700 (PDT) Date: Fri, 22 Oct 2021 10:29:12 -0400 From: Tom Rini To: Wolfgang Denk Cc: Simon Glass , U-Boot Mailing List , u-boot-board-maintainers@lists.denx.de, Rasmus Villemoes , u-boot-custodians@lists.denx.de, Heinrich Schuchardt , Marek =?iso-8859-1?Q?Beh=FAn?= , Joe Hershberger Subject: Re: [PATCH v10 3/9] env: Allow U-Boot scripts to be placed in a .env file Message-ID: <20211022142912.GF3577824@bill-the-cat> References: <20211022030852.1986718-1-sjg@chromium.org> <20211021210847.v10.3.Ie78bfbfca0d01d9cba501e127f446ec48e1f7afe@changeid> <3765086.1634891366@gemini.denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Y1L3PTX8QE8cb2T+" Content-Disposition: inline In-Reply-To: <3765086.1634891366@gemini.denx.de> 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 --Y1L3PTX8QE8cb2T+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 22, 2021 at 10:29:26AM +0200, Wolfgang Denk wrote: > Dear Simon, >=20 > In message <20211021210847.v10.3.Ie78bfbfca0d01d9cba501e127f446ec48e1f7af= e@changeid> you 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 text > > 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 c= an > > extend to multiple lines. See the README under 'Environment Variables:' > > for more information and an example. >=20 > The README does not contain this information as it has been moved > into doc/usage/environment.rst >=20 > I think the documentation is lacking a hint that multiline > definitions will always be separated by spaces. >=20 > > Also support +=3D to allow variables to be appended to. This is needed = when > > using the preprocessor. >=20 > I cannot see what the preprocessor has to do with this feature. It > would be useful in any case, even without the preporcessor. >=20 >=20 > The documentation reads: >=20 > "Variables can contain `+` characters but in the unlikely > event that you want to have a variable name ending in plus, put a backsla= sh > before the `+` so that the script knows you are not adding to an existing > variable but assigning to a new one:: > =20 > maximum\+=3Dvalue > " >=20 > However, '\' is also a legal character in a variable name (and > doubled backslashes or apostrophes etc. are legal, too), so > above line should actually set the environment variable "maximum\+" > to "value". I feel I should preface this with "I am cranky". Now I see that I can indeed do: =3D> setenv foo\\bar baz =3D> printenv foo\\bar foo\bar=3Dbaz on a system today. To what value, I know not. I can see how you write some fancy state machine set of scripts where you end up with "foo+bar+" needing to be set because you do a bunch of probing of things at run time and concatenate and ... there, we've got a variable that ends in + (and fwiw, sh says baz+ is a bad variable name, bash gets kinda funny with it). I don't see the value in allowing "\" in a variable name, nor can I make bash nor sh handle that. We can just disallow "\" in variable names. --=20 Tom --Y1L3PTX8QE8cb2T+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFyyrUACgkQFHw5/5Y0 tywXTgwAiRFmj/M83PjtoNR5dKErHsEj3cZy7Zp74zLcMxla5WiVvgVJH0o8Fxjx IeX3DqT72qOJTyQZUhiD8gQ1PNRXHfSGCRkrWfNgFAuSeP+hKufquNHTppxS799k aoMs2o0xiQ7+Un/tMTRBW5nuymwT/gST9AS5PsgHxHG++jUip4MMeeZIDpdXTDUA EbMvxVNXeF9NdrJcFils8BjG7hT96e3IlxEeGNuXXMXc7LOE1IxfC1wxoMEj8TjB Cn7J+3hyvLGoephIKOEvM4nFU2+CS6sL6Rp6u+TKC/1cwaHdRzftWC2GgRNggpOd UHHESsUBUkPUBXLLKVmv8IhRXmARf2YkgXz9FU6e+zDaIJfOXC+jYvIjwGNrvDbR Bwi7QUDcimwJO2z+4PjYVOsmPqT7ZyzntOTygVAq6EiKKYRRubis0VHbA6xDh1fS H77wu9+PIc3QBFl6afqkZybgJMJg0FjrwbQY6EACVrNshgWWV3UU1JcaTMruq5ZI kIA5+ne2 =o4d4 -----END PGP SIGNATURE----- --Y1L3PTX8QE8cb2T+--