On Fri, May 19, 2017 at 11:07 AM, Denys Dmytriyenko <de...@denix.org> wrote: > On Fri, May 19, 2017 at 01:37:59AM +0200, Enrico Scholz wrote: >> Denys Dmytriyenko <de...@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.
you can toggle '' and "" strings, will keep the readability and embed the string too > > -- > Denys > -- > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core