All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>
Cc: "Marek Behún" <marek.behun@nic.cz>, "Wolfgang Denk" <wd@denx.de>,
	"U-Boot Mailing List" <u-boot@lists.denx.de>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Joe Hershberger" <joe.hershberger@ni.com>
Subject: Re: [PATCH v9 3/7] env: Allow U-Boot scripts to be placed in a .env file
Date: Fri, 22 Oct 2021 08:40:59 +0200	[thread overview]
Message-ID: <4a7d69cd-b4d0-779d-d3f3-2ddfc3e15d27@prevas.dk> (raw)
In-Reply-To: <20211021160311.GC3577824@bill-the-cat>

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 <marek.behun@nic.cz> wrote:
>>>
>>> On Thu, 21 Oct 2021 15:25:37 +0200
>>> Marek Behún <marek.behun@nic.cz> wrote:
>>>
>>>> Hello,
>>>>
>>>> On Thu, 21 Oct 2021 15:06:51 +0200
>>>> Wolfgang Denk <wd@denx.de> 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.

Rasmus

  parent reply	other threads:[~2021-10-22  6:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 22:44 [PATCH v9 0/7] env: Allow environment in text files Simon Glass
2021-10-19 22:44 ` [PATCH v9 1/7] sandbox: Drop distro_boot Simon Glass
2021-10-19 22:44 ` [PATCH v9 2/7] doc: Move environment documentation to rST Simon Glass
2021-10-20  6:38   ` Heinrich Schuchardt
2021-10-22  3:05     ` Simon Glass
2021-10-19 22:44 ` [PATCH v9 3/7] env: Allow U-Boot scripts to be placed in a .env file Simon Glass
2021-10-21  9:50   ` Wolfgang Denk
2021-10-21 12:23     ` Tom Rini
2021-10-21 13:06       ` Wolfgang Denk
2021-10-21 13:25         ` Marek Behún
2021-10-21 13:28           ` Marek Behún
2021-10-21 15:12             ` Wolfgang Denk
2021-10-21 15:18               ` Tom Rini
2021-10-21 15:59             ` Simon Glass
2021-10-21 16:03               ` Tom Rini
2021-10-21 16:51                 ` Simon Glass
2021-10-22  6:40                 ` Rasmus Villemoes [this message]
2021-10-24 19:54                   ` Simon Glass
2021-10-25  7:06                     ` Rasmus Villemoes
2021-10-25 15:18                       ` Simon Glass
2021-10-25 19:52                         ` Rasmus Villemoes
2021-10-26 10:15                         ` Wolfgang Denk
2021-10-28 14:18                           ` Simon Glass
2021-10-22  8:08                 ` Wolfgang Denk
2021-10-22 14:47                   ` Tom Rini
2021-10-24 15:46                     ` Wolfgang Denk
2021-10-24 16:44                       ` Tom Rini
2021-10-25  7:48                         ` Wolfgang Denk
2021-10-22  8:06               ` Wolfgang Denk
2021-10-22 14:04                 ` Marek Behún
2021-10-22 14:50                 ` Tom Rini
2021-10-19 22:44 ` [PATCH v9 4/7] sandbox: Use a text-based environment Simon Glass
2021-10-20  6:58   ` Alexander Dahl
2021-10-19 22:44 ` [PATCH v9 5/7] doc: Mention CONFIG_DEFAULT_ENV_FILE Simon Glass
2021-10-19 22:44 ` [PATCH v9 6/7] doc: Improve environment documentation Simon Glass
2021-10-19 22:44 ` [PATCH v9 7/7] bootm: Tidy up use of autostart env var Simon Glass
2021-10-21 14:02 ` [PATCH v9 0/7] env: Allow environment in text files Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a7d69cd-b4d0-779d-d3f3-2ddfc3e15d27@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=joe.hershberger@ni.com \
    --cc=marek.behun@nic.cz \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.