From: Denys Dmytriyenko <denis@denix.org>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] tzcode-native: quote ${CC}
Date: Fri, 19 May 2017 14:07:20 -0400 [thread overview]
Message-ID: <20170519180720.GW28053@denix.org> (raw)
In-Reply-To: <lyinkxrb1k.fsf@ensc-virt.intern.sigma-chemnitz.de>
On Fri, May 19, 2017 at 01:37:59AM +0200, Enrico Scholz wrote:
> Denys Dmytriyenko <denis@denix.org> writes:
>
> >> -EXTRA_OEMAKE += "cc=${CC}"
> >> +EXTRA_OEMAKE += "cc='${CC}'"
> >
> > Should these be double-quotes around ${CC}?
>
> I wrote it in this way:
>
> - to 60%, because '' is more correct than "" in this context (see below)
>
> - to 40%, because "" would clutter code too much and I can not say
> whether it must be quoted as \", \\" or whether perhaps plain " works
> too
FWIW, bitbake handles nested quotes properly, no escaping needed:
+EXTRA_OEMAKE += "cc="${CC}""
> A yet more correct solution would be
>
> | export cc = "${CC}"
>
> in the recipe (outside of do_*()) and perhaps adding '-e' to EXTRA_OEMAKE.
>
>
> This handles additionally the case when 'CC' contains a single quote
> (which causes misbehavior in my patch).
>
> Double quotes are much more worse because CC must not contain '$', '`'
> or '\\' (which is not uncommon in flags like '-DFOO()=\"bar\"'). In OE,
> it is not expected that these characters are interpreted directly by the
> shell (${CC} is passed properly quoted in the environment).
>
> But all this does not matter... correct quoting is neglactted in OE and
> bitbake; when you are lucky, commands are written as "foo '%s'" % path.
> But nobody uses functions like 'pipes.quote()' or a non-shell variants
> like subprocess.call(['foo', path]).
>
> So, you can assume that '${FOO}' expands to the same value like "${FOO}".
Yes, bitbake variables will be expanded properly regardles of the quotes.
Passing a shell variable may cause problems, but may not be a good practice
in general.
--
Denys
next prev parent reply other threads:[~2017-05-19 18:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 17:34 [PATCH] tzcode-native: quote ${CC} Enrico Scholz
2017-05-18 18:19 ` Denys Dmytriyenko
2017-05-18 18:57 ` Khem Raj
2017-05-18 21:37 ` Christopher Larson
2017-05-18 21:54 ` Denys Dmytriyenko
2017-05-18 22:38 ` Christopher Larson
2017-05-18 23:37 ` Enrico Scholz
2017-05-19 18:07 ` Denys Dmytriyenko [this message]
2017-05-19 18:09 ` Khem Raj
-- strict thread matches above, loose matches on Subject: below --
2017-06-23 11:19 Enrico Scholz
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=20170519180720.GW28053@denix.org \
--to=denis@denix.org \
--cc=enrico.scholz@sigma-chemnitz.de \
--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 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.