* [PATCH 1/2] boot: ignore all spaces between boot targets
@ 2020-09-14 15:27 Ahmad Fatoum
2020-09-14 15:27 ` [PATCH 2/2] blspec: devicetree-overlay: don't warn on multiple delimiting spaces Ahmad Fatoum
2020-09-15 7:31 ` [PATCH 1/2] boot: ignore all spaces between boot targets Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2020-09-14 15:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Boot targets are split by space. strsep unlike strtok(_r) returns an
empty string for each pair of consecutive delimiters. Ignore this case.
Note that this changes behavior: previously both
boot ''
global.boot.default= boot
were identical to
boot /env/boot
With this change, this is no longer the case.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
commands/boot.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/commands/boot.c b/commands/boot.c
index ad2d83a17912..d7795bde726b 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -76,6 +76,8 @@ static int do_boot(int argc, char *argv[])
entries = bootentries_alloc();
while ((name = next(&handle)) != NULL) {
+ if (!*name)
+ continue;
ret = bootentry_create_from_name(entries, name);
if (ret <= 0)
printf("Nothing bootable found on '%s'\n", name);
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] blspec: devicetree-overlay: don't warn on multiple delimiting spaces
2020-09-14 15:27 [PATCH 1/2] boot: ignore all spaces between boot targets Ahmad Fatoum
@ 2020-09-14 15:27 ` Ahmad Fatoum
2020-09-15 7:31 ` [PATCH 1/2] boot: ignore all spaces between boot targets Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2020-09-14 15:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum, Michael Tretter
strsep unlike strtok(_r) returns an empty string for each pair of
consecutive delimiters.
blspec_apply_oftree_overlay is not equipped to handle an empty
string and will attempt treating "abspath/" as device tree file.
Explicitly check for empty strings, so this doesn't happen.
Cc: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Change is untested
---
common/blspec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/blspec.c b/common/blspec.c
index 9e1036c8342c..ed66352d1107 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -109,8 +109,11 @@ static void blspec_apply_oftree_overlays(const char *overlays,
sep = freep = xstrdup(overlays);
- while ((overlay = strsep(&sep, " ")))
+ while ((overlay = strsep(&sep, " "))) {
+ if (!*overlay)
+ continue;
blspec_apply_oftree_overlay(overlay, abspath, dryrun);
+ }
free(freep);
}
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] boot: ignore all spaces between boot targets
2020-09-14 15:27 [PATCH 1/2] boot: ignore all spaces between boot targets Ahmad Fatoum
2020-09-14 15:27 ` [PATCH 2/2] blspec: devicetree-overlay: don't warn on multiple delimiting spaces Ahmad Fatoum
@ 2020-09-15 7:31 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2020-09-15 7:31 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Sep 14, 2020 at 05:27:10PM +0200, Ahmad Fatoum wrote:
> Boot targets are split by space. strsep unlike strtok(_r) returns an
> empty string for each pair of consecutive delimiters. Ignore this case.
>
> Note that this changes behavior: previously both
> boot ''
> global.boot.default= boot
>
> were identical to
> boot /env/boot
>
> With this change, this is no longer the case.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> commands/boot.c | 2 ++
> 1 file changed, 2 insertions(+)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-15 7:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 15:27 [PATCH 1/2] boot: ignore all spaces between boot targets Ahmad Fatoum
2020-09-14 15:27 ` [PATCH 2/2] blspec: devicetree-overlay: don't warn on multiple delimiting spaces Ahmad Fatoum
2020-09-15 7:31 ` [PATCH 1/2] boot: ignore all spaces between boot targets Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox