diff mbox series

[oe-layersetup,15/15] oe-layertool-setup: add sanity check for layer names

Message ID 20230607200504.3810426-16-rs@ti.com
State Superseded
Delegated to: Ryan Eatmon
Headers show
Series Sacrifice your first born to the linter | expand

Commit Message

Randolph Sapp June 7, 2023, 8:05 p.m. UTC
From: StaticRocket <35777938+StaticRocket@users.noreply.github.com>

Due to POSIX shell string parsing limitations we currently can't parse
layer names with spaces. Display an error message and bail out when
detected.

Signed-off-by: StaticRocket <35777938+StaticRocket@users.noreply.github.com>
---
 oe-layertool-setup.sh | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/oe-layertool-setup.sh b/oe-layertool-setup.sh
index 2b05550..16b7844 100755
--- a/oe-layertool-setup.sh
+++ b/oe-layertool-setup.sh
@@ -211,6 +211,13 @@  parse_repo_line() {
     then
         temp_layers=""
         temp=$(printf '%s\n' "$parsed_layers" | cut -d= -f2)
+        # sanity check for whitespace in layer names string
+        if printf '%s\n' "$temp" | grep -q '\s'
+        then
+            printf '%s\n' "Whitespace character detected in layer names string!" \
+                          "This is currently unsupported." ;
+            exit 1
+        fi
         # use tr to split the layers since we assume layer names don't have
         # whitespace characters later anyway
         for x in $(printf '%s\n' "$temp" | tr ':' ' ')