From: "Marek Behún" <kabel@kernel.org>
To: Simon Glass <sjg@chromium.org>
Cc: "Pali Rohár" <pali@kernel.org>, "Stefan Roese" <sr@denx.de>,
u-boot@lists.denx.de, "Marek Behún" <marek.behun@nic.cz>
Subject: Re: [PATCH 2/5] env: Fix env_get() when returning empty string using env_get_f()
Date: Sun, 31 Oct 2021 16:27:07 +0100 [thread overview]
Message-ID: <20211031162707.1065cab3@thinkpad> (raw)
In-Reply-To: <CAPnjgZ2iZF9cNDqGC2n2Ozcbj7a6w5xwNuBAd78mSnTb5KAUvA@mail.gmail.com>
On Sun, 31 Oct 2021 07:07:47 -0600
Simon Glass <sjg@chromium.org> wrote:
> Hi,
>
> On Fri, 29 Oct 2021 at 03:03, Pali Rohár <pali@kernel.org> wrote:
> >
> > On Thursday 28 October 2021 21:17:38 Simon Glass wrote:
> > > Hi Marek,
> > >
> > > On Wed, 27 Oct 2021 at 21:28, Marek Behún <kabel@kernel.org> wrote:
> > > >
> > > > From: Marek Behún <marek.behun@nic.cz>
> > > >
> > > > The env_get_f() function returns -1 on failure. Returning 0 means that
> > > > the variable exists, and is empty string.
> > > >
> > > > Signed-off-by: Marek Behún <marek.behun@nic.cz>
> > > > ---
> > > > env/common.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > But it isn't normally possible to set an env var to an empty string.
> > > How does this happen?
> >
> > IIRC you can set variable to empty string via e.g.:
> >
> > setenv abc ''
>
> Yes that works and I now see you are all right. In fact the command
> handling for 'env set' does not use env_set().
>
> It seems a bit inconsistent to me. Since a deleted variable is
> considered empty, do we need to support empty vars?
Depends on what you mean by "support". I think that if the user
does
setenv xyz ""
it shouldn't be an error. Whether it deletes the variable or not is
something different (although I would make it so that the variable is
not deleted...).
But env_get_f("xyz") shouldn't return -1 in this case, as that indicates
an error.
Marek
next prev parent reply other threads:[~2021-10-31 15:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 3:28 [PATCH 0/5] Board specific runtime determined default env Marek Behún
2021-10-28 3:28 ` [PATCH 1/5] env: Don't set ready flag if import failed in env_set_default() Marek Behún
2021-10-29 3:17 ` Simon Glass
2021-10-28 3:28 ` [PATCH 2/5] env: Fix env_get() when returning empty string using env_get_f() Marek Behún
2021-10-29 3:17 ` Simon Glass
2021-10-29 8:51 ` Marek Behún
2021-10-29 9:03 ` Pali Rohár
2021-10-31 13:07 ` Simon Glass
2021-10-31 15:27 ` Marek Behún [this message]
2021-10-28 3:28 ` [PATCH 3/5] env: Simplify env_get_default() Marek Behún
2021-10-29 3:17 ` Simon Glass
2021-10-28 3:28 ` [PATCH 4/5] env: Add support for board specific special default environment Marek Behún
2021-10-29 3:17 ` Simon Glass
2021-10-29 8:57 ` Marek Behún
2021-10-31 13:07 ` Simon Glass
2021-10-28 3:28 ` [PATCH 5/5] arm: mvebu: Espressobin: Use new API for setting default env at runtime Marek Behún
2021-10-29 3:17 ` Simon Glass
2021-10-31 20:15 ` Pali Rohár
2021-11-02 14:57 ` Simon Glass
2021-11-03 10:48 ` Pali Rohár
2021-10-29 3:17 ` [PATCH 0/5] Board specific runtime determined default env Simon Glass
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=20211031162707.1065cab3@thinkpad \
--to=kabel@kernel.org \
--cc=marek.behun@nic.cz \
--cc=pali@kernel.org \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.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.