All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
@ 2022-04-05 17:17 Abongwa Bonalais Amahnui
  2022-04-06  3:08 ` [OE-core] " ChenQi
  0 siblings, 1 reply; 7+ messages in thread
From: Abongwa Bonalais Amahnui @ 2022-04-05 17:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Abongwa Bonalais Amahnui

Used shellcheck to add quotes to the variables. This is to make sure that 
directories with names that have space between, such as "Desktop/projects/test repo/poky" 
will not be considered as 2 separate words. With this modification, running the command "source oe-init-build-env" will not give the error "bash: oe-init-build-env: No such file or directory"

Signed-off-by: Abongwa Bonalais Amahnui <abongwabonalais@gmail.com>
---
 oe-init-build-env         | 4 ++--
 scripts/oe-setup-builddir | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/oe-init-build-env b/oe-init-build-env
index 8c1bd54e57..38333ab858 100755
--- a/oe-init-build-env
+++ b/oe-init-build-env
@@ -42,8 +42,8 @@ fi
 unset THIS_SCRIPT
 
 export OEROOT
-. $OEROOT/scripts/oe-buildenv-internal &&
-    TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir || {
+. "$OEROOT"/scripts/oe-buildenv-internal &&
+    TEMPLATECONF="$TEMPLATECONF" "$OEROOT"/scripts/oe-setup-builddir || {
     unset OEROOT
     return 1
 }
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index d4ac074ad9..54048e62ec 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -42,7 +42,7 @@ if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
     TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg")
 fi
 
-. $OEROOT/.templateconf
+. "$OEROOT"/.templateconf
 
 if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
     echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"
@@ -79,7 +79,7 @@ example, select a different MACHINE (target hardware). See conf/local.conf
 for more information as common configuration options are commented.
 
 EOM
-    cp -f $OECORELOCALCONF "$BUILDDIR/conf/local.conf"
+    cp -f "$OECORELOCALCONF" "$BUILDDIR/conf/local.conf"
     SHOWYPDOC=yes
 fi
 
@@ -100,7 +100,7 @@ EOM
     # to replace it for compatibility.
     sed -e "s|##OEROOT##|$OEROOT|g" \
         -e "s|##COREBASE##|$OEROOT|g" \
-        $OECORELAYERCONF > "$BUILDDIR/conf/bblayers.conf"
+        "$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
     SHOWYPDOC=yes
 fi
 
@@ -125,5 +125,5 @@ fi
 if [ -z "$OECORENOTESCONF" ]; then
     OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
 fi
-[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
+[ ! -r "$OECORENOTESCONF" ] || cat "$OECORENOTESCONF"
 unset OECORENOTESCONF
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [OE-core] [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
  2022-04-05 17:17 [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts Abongwa Bonalais Amahnui
@ 2022-04-06  3:08 ` ChenQi
  2022-04-06  5:49   ` Abongwa Amahnui Bonalais
  2022-04-06  7:07   ` [OE-core] " Richard Purdie
  0 siblings, 2 replies; 7+ messages in thread
From: ChenQi @ 2022-04-06  3:08 UTC (permalink / raw)
  To: Abongwa Amahnui Bonalais, openembedded-core

Whitespace is not a valid char in builddir. There's sanity check for 
this in sanity.bbclass:
if val.find(' ') != -1:
             status.addresult("Error, you have a space in your %s 
directory path. Please move the installation to a directory which 
doesn't include a space since autotools doesn't support this." % checkdir)

Regards,
Qi

On 4/6/22 01:17, Abongwa Amahnui Bonalais wrote:
> Used shellcheck to add quotes to the variables. This is to make sure that
> directories with names that have space between, such as "Desktop/projects/test repo/poky"
> will not be considered as 2 separate words. With this modification, running the command "source oe-init-build-env" will not give the error "bash: oe-init-build-env: No such file or directory"
>
> Signed-off-by: Abongwa Bonalais Amahnui <abongwabonalais@gmail.com>
> ---
>   oe-init-build-env         | 4 ++--
>   scripts/oe-setup-builddir | 8 ++++----
>   2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/oe-init-build-env b/oe-init-build-env
> index 8c1bd54e57..38333ab858 100755
> --- a/oe-init-build-env
> +++ b/oe-init-build-env
> @@ -42,8 +42,8 @@ fi
>   unset THIS_SCRIPT
>   
>   export OEROOT
> -. $OEROOT/scripts/oe-buildenv-internal &&
> -    TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir || {
> +. "$OEROOT"/scripts/oe-buildenv-internal &&
> +    TEMPLATECONF="$TEMPLATECONF" "$OEROOT"/scripts/oe-setup-builddir || {
>       unset OEROOT
>       return 1
>   }
> diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
> index d4ac074ad9..54048e62ec 100755
> --- a/scripts/oe-setup-builddir
> +++ b/scripts/oe-setup-builddir
> @@ -42,7 +42,7 @@ if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
>       TEMPLATECONF=$(cat "$BUILDDIR/conf/templateconf.cfg")
>   fi
>   
> -. $OEROOT/.templateconf
> +. "$OEROOT"/.templateconf
>   
>   if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
>       echo "$TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg"
> @@ -79,7 +79,7 @@ example, select a different MACHINE (target hardware). See conf/local.conf
>   for more information as common configuration options are commented.
>   
>   EOM
> -    cp -f $OECORELOCALCONF "$BUILDDIR/conf/local.conf"
> +    cp -f "$OECORELOCALCONF" "$BUILDDIR/conf/local.conf"
>       SHOWYPDOC=yes
>   fi
>   
> @@ -100,7 +100,7 @@ EOM
>       # to replace it for compatibility.
>       sed -e "s|##OEROOT##|$OEROOT|g" \
>           -e "s|##COREBASE##|$OEROOT|g" \
> -        $OECORELAYERCONF > "$BUILDDIR/conf/bblayers.conf"
> +        "$OECORELAYERCONF" > "$BUILDDIR/conf/bblayers.conf"
>       SHOWYPDOC=yes
>   fi
>   
> @@ -125,5 +125,5 @@ fi
>   if [ -z "$OECORENOTESCONF" ]; then
>       OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
>   fi
> -[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF
> +[ ! -r "$OECORENOTESCONF" ] || cat "$OECORENOTESCONF"
>   unset OECORENOTESCONF
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#164050): https://lists.openembedded.org/g/openembedded-core/message/164050
> Mute This Topic: https://lists.openembedded.org/mt/90270943/3618072
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Qi.Chen@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
  2022-04-06  3:08 ` [OE-core] " ChenQi
@ 2022-04-06  5:49   ` Abongwa Amahnui Bonalais
  2022-04-06  7:07   ` [OE-core] " Richard Purdie
  1 sibling, 0 replies; 7+ messages in thread
From: Abongwa Amahnui Bonalais @ 2022-04-06  5:49 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

Hi Qi
Thanks for the clarity, Therefore there is no need to put whitespaces in qoutes if it will be checked for and an error message reported concerning it in future.
That means we just have to let oe-init-build-env  tell you at the early stages.
Thanks I understand.

[-- Attachment #2: Type: text/html, Size: 289 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OE-core] [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
  2022-04-06  3:08 ` [OE-core] " ChenQi
  2022-04-06  5:49   ` Abongwa Amahnui Bonalais
@ 2022-04-06  7:07   ` Richard Purdie
  2022-04-06  7:37     ` Abongwa Amahnui Bonalais
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2022-04-06  7:07 UTC (permalink / raw)
  To: Chen Qi, Abongwa Amahnui Bonalais, openembedded-core

On Wed, 2022-04-06 at 11:08 +0800, Chen Qi wrote:
> Whitespace is not a valid char in builddir. There's sanity check for 
> this in sanity.bbclass:
> if val.find(' ') != -1:
>              status.addresult("Error, you have a space in your %s 
> directory path. Please move the installation to a directory which 
> doesn't include a space since autotools doesn't support this." % checkdir)

The issue was that you couldn't reach that error message if you had a space in
the build path. This change allows you to reach the sanity check!

Cheers,

Richard


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
  2022-04-06  7:07   ` [OE-core] " Richard Purdie
@ 2022-04-06  7:37     ` Abongwa Amahnui Bonalais
  2022-04-06  8:23       ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 7+ messages in thread
From: Abongwa Amahnui Bonalais @ 2022-04-06  7:37 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 105 bytes --]

Hi Richard
I presume it is a good change since the user will know what is wrong and be able to fix it.

[-- Attachment #2: Type: text/html, Size: 115 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [OE-core] [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
  2022-04-06  7:37     ` Abongwa Amahnui Bonalais
@ 2022-04-06  8:23       ` Richard Purdie
  2022-04-06  9:34         ` Abongwa Amahnui Bonalais
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2022-04-06  8:23 UTC (permalink / raw)
  To: Abongwa Amahnui Bonalais, openembedded-core

On Wed, 2022-04-06 at 00:37 -0700, Abongwa Amahnui Bonalais wrote:
> Hi Richard 
> I presume it is a good change since the user will know what is wrong and be
> able to fix it.

Yes, I did merge it to master with a small fix to the subject line to clarify
where the patch was being applied to.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts.
  2022-04-06  8:23       ` [OE-core] " Richard Purdie
@ 2022-04-06  9:34         ` Abongwa Amahnui Bonalais
  0 siblings, 0 replies; 7+ messages in thread
From: Abongwa Amahnui Bonalais @ 2022-04-06  9:34 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 67 bytes --]

Hi Richard,
I am happy to have made a positive addition.
Thanks

[-- Attachment #2: Type: text/html, Size: 75 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-06 16:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 17:17 [PATCH] Added quotes around variables to prevent word splitting in the oe-init-build-env/oe-setup-builddir shell scripts Abongwa Bonalais Amahnui
2022-04-06  3:08 ` [OE-core] " ChenQi
2022-04-06  5:49   ` Abongwa Amahnui Bonalais
2022-04-06  7:07   ` [OE-core] " Richard Purdie
2022-04-06  7:37     ` Abongwa Amahnui Bonalais
2022-04-06  8:23       ` [OE-core] " Richard Purdie
2022-04-06  9:34         ` Abongwa Amahnui Bonalais

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.