* what shell programming constructs can we count on in .bbclass files?
@ 2017-03-15 10:44 Robert P. J. Day
2017-03-15 11:05 ` Burton, Ross
0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2017-03-15 10:44 UTC (permalink / raw)
To: OE Core mailing list
what shell (or level of POSIX compatibility) does one assume for
writing shell functions in .bbclass files?
i'm looking at kernel-fitimage.bbclass and i see this:
#
# Step 7: Sign the image and add public key to U-Boot dtb
#
if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
surely we don't still need to use that ugly "x" prefix hack for string
comparisons, do we?
a bit further down:
do_assemble_fitimage_initramfs() {
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
test -n "${INITRAMFS_IMAGE}" ; then
would it not be equivalent to write that second test as:
[ -n "${INITRAMFS_IMAGE}"]
and so on. what are we allowed to count on?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: what shell programming constructs can we count on in .bbclass files?
2017-03-15 10:44 what shell programming constructs can we count on in .bbclass files? Robert P. J. Day
@ 2017-03-15 11:05 ` Burton, Ross
2017-03-15 12:40 ` Patrick Ohly
0 siblings, 1 reply; 5+ messages in thread
From: Burton, Ross @ 2017-03-15 11:05 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: OE Core mailing list
[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]
On 15 March 2017 at 10:44, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> what shell (or level of POSIX compatibility) does one assume for
> writing shell functions in .bbclass files?
>
> i'm looking at kernel-fitimage.bbclass and i see this:
>
> #
> # Step 7: Sign the image and add public key to U-Boot dtb
> #
> if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
>
> surely we don't still need to use that ugly "x" prefix hack for string
> comparisons, do we?
>
> a bit further down:
>
> do_assemble_fitimage_initramfs() {
> if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
> test -n "${INITRAMFS_IMAGE}" ; then
>
> would it not be equivalent to write that second test as:
>
> [ -n "${INITRAMFS_IMAGE}"]
>
> and so on. what are we allowed to count on?
>
xFOO = xBAR appears to be a long-standing hangover from the 70s, any POSIX
shell should be safe with quoted instead.
Our shell parser *should* be POSIX compliant. There are a few places where
it isn't, but I believe those should be considered bugs. At the end of the
day the shell is actually executed by /bin/sh or /bin/bash anyway, so as
long as bitbake can parse it you can use anything.
Ross
[-- Attachment #2: Type: text/html, Size: 1870 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: what shell programming constructs can we count on in .bbclass files?
2017-03-15 11:05 ` Burton, Ross
@ 2017-03-15 12:40 ` Patrick Ohly
2017-03-15 13:34 ` Robert P. J. Day
2017-03-15 14:48 ` Burton, Ross
0 siblings, 2 replies; 5+ messages in thread
From: Patrick Ohly @ 2017-03-15 12:40 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE Core mailing list
On Wed, 2017-03-15 at 11:05 +0000, Burton, Ross wrote:
> Our shell parser *should* be POSIX compliant. There are a few places
> where it isn't, but I believe those should be considered bugs. At the
> end of the day the shell is actually executed by /bin/sh or /bin/bash
> anyway, so as long as bitbake can parse it you can use anything.
Unfortunately bitbake has problems parsing useful things like $( ). Are
there open bugs about that and/or is it worth filing enhancement
requests?
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what shell programming constructs can we count on in .bbclass files?
2017-03-15 12:40 ` Patrick Ohly
@ 2017-03-15 13:34 ` Robert P. J. Day
2017-03-15 14:48 ` Burton, Ross
1 sibling, 0 replies; 5+ messages in thread
From: Robert P. J. Day @ 2017-03-15 13:34 UTC (permalink / raw)
To: Patrick Ohly; +Cc: OE Core mailing list
On Wed, 15 Mar 2017, Patrick Ohly wrote:
> On Wed, 2017-03-15 at 11:05 +0000, Burton, Ross wrote:
> > Our shell parser *should* be POSIX compliant. There are a few
> > places where it isn't, but I believe those should be considered
> > bugs. At the end of the day the shell is actually executed by
> > /bin/sh or /bin/bash anyway, so as long as bitbake can parse it
> > you can use anything.
>
> Unfortunately bitbake has problems parsing useful things like $( ).
> Are there open bugs about that and/or is it worth filing enhancement
> requests?
on a more basic level, there's quite a lot of, i guess, bourne
shell'isms (and other weirdnesses) still lying around. in
meta/classes/, some examples (hoping i didn't screw them up):
"if test" rather then "if ["
all that 'if [ "x${VAR} = "x" ]' i mentioned earlier
if [ "x${ICE_PATH}" = "x" ] rather than if [ -z "${ICE_PATH}" ]
if [ ! -z "${conf_sign_keyname}" ] ... ?????? :-)
none of this is a big deal, but there sure are some historical
holdovers and strangely-chosen constructs.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: what shell programming constructs can we count on in .bbclass files?
2017-03-15 12:40 ` Patrick Ohly
2017-03-15 13:34 ` Robert P. J. Day
@ 2017-03-15 14:48 ` Burton, Ross
1 sibling, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2017-03-15 14:48 UTC (permalink / raw)
To: Patrick Ohly; +Cc: OE Core mailing list
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
On 15 March 2017 at 12:40, Patrick Ohly <patrick.ohly@intel.com> wrote:
> Unfortunately bitbake has problems parsing useful things like $( ). Are
> there open bugs about that and/or is it worth filing enhancement
> requests?
>
Absolutely worth filing bugs. Worst case, they get marked as duplicates.
Ross
[-- Attachment #2: Type: text/html, Size: 729 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-15 14:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-15 10:44 what shell programming constructs can we count on in .bbclass files? Robert P. J. Day
2017-03-15 11:05 ` Burton, Ross
2017-03-15 12:40 ` Patrick Ohly
2017-03-15 13:34 ` Robert P. J. Day
2017-03-15 14:48 ` Burton, Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox