Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Abongwa Amahnui Bonalais <abongwabonalais@gmail.com>
Cc: Mike Looijmans <mike.looijmans@topic.nl>,
	"openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: RE: [OE-core] [PATCH] "bitbake-prserv-tool: Added quotes to variables to prevent splitting and gobbling"
Date: Wed, 13 Apr 2022 10:21:02 +0000	[thread overview]
Message-ID: <2e190a133b2a4139a0909a4bba5acd58@axis.com> (raw)
In-Reply-To: <887a4cc8-7d2c-e39f-b6c1-ae45d9a18583@topic.nl>

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Mike Looijmans
> Sent: den 13 april 2022 11:52
> To: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH] "bitbake-prserv-tool: Added quotes to variables to prevent splitting and gobbling"

There shouldn't be quotes in the subject above. No idea how you 
managed to get them there...

Also, "gobbling" is not a word, AFAIK. Did you mean "globbing"?

> 
> See comment below (our mail server injects signatures, sorry for that)
> 
> 
> Met vriendelijke groet / kind regards,
> 
> Mike Looijmans
> System Expert
> 
> 
> TOPIC Embedded Products B.V.
> Materiaalweg 4, 5681 RJ Best
> The Netherlands
> 
> T: +31 (0) 499 33 69 69
> E: mike.looijmans@topicproducts.com
> W: www.topic.nl
> 
> Please consider the environment before printing this e-mail
> On 13-04-2022 11:35, Abongwa Amahnui Bonalais via lists.openembedded.org wrote:
> > Signed-off-by: Abongwa Bonalais Amahnui <abongwabonalais@gmail.com>
> > ---
> >   scripts/bitbake-prserv-tool | 22 +++++++++++-----------
> >   1 file changed, 11 insertions(+), 11 deletions(-)
> >
> > diff --git a/scripts/bitbake-prserv-tool b/scripts/bitbake-prserv-tool
> > index e55d98c72e..68caa9fb66 100755
> > --- a/scripts/bitbake-prserv-tool
> > +++ b/scripts/bitbake-prserv-tool
> > @@ -5,7 +5,7 @@
> >
> >   help ()
> >   {
> > -    base=`basename $0`
> > +    base=`basename "$0"`
> >       echo -e "Usage: $base command"
> >       echo "Avaliable commands:"
> >       echo -e "\texport <file.conf>: export and lock down the AUTOPR values from the PR service into a file for release."
> > @@ -16,7 +16,7 @@ clean_cache()
> >   {
> >       s=`bitbake -e | grep ^CACHE= | cut -f2 -d\"`
> >       if [ "x${s}" != "x" ]; then
> > -        rm -rf ${s}
> > +        rm -rf "${s}"
> >       fi
> >   }
> >
> > @@ -24,14 +24,14 @@ do_export ()
> >   {
> >       file=$1
> 
> You'd want to quote this one too I think.

Actually, as inconsistent as it may seem, quotes are _not_ needed above.

> 
> >       [ "x${file}" == "x" ] && help && exit 1
> > -    rm -f ${file}
> > +    rm -f "${file}"
> >
> >       clean_cache
> >       bitbake -R conf/prexport.conf -p
> >       s=`bitbake -R conf/prexport.conf -e | grep ^PRSERV_DUMPFILE= | cut -f2 -d\"`
> >       if [ "x${s}" != "x" ];
> >       then
> > -       [ -e $s ] && mv -f $s $file && echo "Exporting to file $file succeeded!"
> > +       [ -e "$s" ] && mv -f "$s" "$file" && echo "Exporting to file $file succeeded!"
> >          return 0
> >       fi
> >       echo "Exporting to file $file failed!"
> > @@ -44,7 +44,7 @@ do_import ()
> >       [ "x${file}" == "x" ] && help && exit 1
> >
> >       clean_cache
> > -    bitbake -R conf/primport.conf -R $file -p
> > +    bitbake -R conf/primport.conf -R "$file" -p
> >       ret=$?
> >       [ $ret -eq 0 ] && echo "Importing from file $file succeeded!" || echo "Importing from file $file failed!"
> >       return $ret
> > @@ -60,13 +60,13 @@ do_migrate_localcount ()
> >           return 1
> >       fi
> >
> > -    rm -rf $df
> > +    rm -rf "$df"
> >       clean_cache
> >       echo "Exporting LOCALCOUNT to AUTOINCs..."
> >       bitbake -R conf/migrate_localcount.conf -p
> >       [ ! $? -eq 0 ] && echo "Exporting to file $df failed!" && exit 1
> >
> > -    if [ -e $df ];
> > +    if [ -e "$df" ];
> >       then
> >           echo "Exporting to file $df succeeded!"
> >       else
> > @@ -75,7 +75,7 @@ do_migrate_localcount ()
> >       fi
> >
> >       echo "Importing generated AUTOINC entries..."
> > -    [ -e $df ] && do_import $df
> > +    [ -e "$df" ] && do_import "$df"
> >
> >       if [ ! $? -eq 0 ]
> >       then
> > @@ -93,17 +93,17 @@ case $2 in
> >   *.conf|*.inc)
> >       ;;
> >   *)
> > -    echo ERROR: $2 must end with .conf or .inc!
> > +    echo ERROR: "$2" must end with .conf or .inc!

The quote above is strictly not needed as the output from echo 
will be the same regardless if there are spaces in $2 or not. 
However, if you really want to quote that line, a more natural 
way would be:

    echo "ERROR: $2 must end with .conf or .inc!"

> >       exit 1
> >       ;;
> >   esac
> >
> >   case $1 in
> >   export)
> > -    do_export $2
> > +    do_export "$2"
> >       ;;
> >   import)
> > -    do_import $2
> > +    do_import "$2"
> >       ;;
> >   migrate_localcount)
> >       do_migrate_localcount

//Peter


  parent reply	other threads:[~2022-04-13 15:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.4b547764-f1ab-4220-9cb3-e9c4ae848711@emailsignatures365.codetwo.com>
     [not found] ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.0d2bd5fa-15cc-4b27-b94e-83614f9e5b38.e4d1c566-c78b-4344-9ede-7a749348d920@emailsignatures365.codetwo.com>
2022-04-13  9:35   ` [PATCH] "bitbake-prserv-tool: Added quotes to variables to prevent splitting and gobbling" Abongwa Bonalais Amahnui
2022-04-13  9:51     ` [OE-core] " Mike Looijmans
2022-04-13 10:10       ` Abongwa Amahnui Bonalais
2022-04-13 10:21       ` Peter Kjellerstedt [this message]
2022-04-13 10:30         ` Abongwa Amahnui Bonalais
2022-04-13 10:34     ` [OE-core] " Richard Purdie
2022-04-13 10:50       ` Abongwa Amahnui Bonalais
2022-04-13 11:13         ` [OE-core] " Richard Purdie
2022-04-13 12:52           ` Abongwa Amahnui Bonalais
2022-04-13 12:55             ` [OE-core] " Richard Purdie
2022-04-13 15:23               ` Abongwa Amahnui Bonalais

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=2e190a133b2a4139a0909a4bba5acd58@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=abongwabonalais@gmail.com \
    --cc=mike.looijmans@topic.nl \
    --cc=openembedded-core@lists.openembedded.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox