Openembedded Core Discussions
 help / color / mirror / Atom feed
* what's with the loop with "in in" in u-boot.inc?
@ 2015-03-07 14:04 Robert P. J. Day
  2015-03-07 17:48 ` Bernhard Reutner-Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Robert P. J. Day @ 2015-03-07 14:04 UTC (permalink / raw)
  To: OE Core mailing list


  based on a recent post to this(?) list, i was curious about the
following loop construct in u-boot.inc:

        for config in ${UBOOT_MACHINE}; do
            for type in in ${UBOOT_CONFIG}; do
                if [ "${type}"x = "in"x ]
                then
                    continue
                fi

  the words "in in" above don't appear to be a typo, as the next
condition explicitly checks for the value "in" and skips it. what's
the rationale for that? i used "git blame" to examine the commit that
introduced that, but it says nothing about that curiosity.

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] 4+ messages in thread

* Re: what's with the loop with "in in" in u-boot.inc?
  2015-03-07 14:04 what's with the loop with "in in" in u-boot.inc? Robert P. J. Day
@ 2015-03-07 17:48 ` Bernhard Reutner-Fischer
  2015-03-08  5:04   ` Gary Thomas
  0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Reutner-Fischer @ 2015-03-07 17:48 UTC (permalink / raw)
  To: Robert P. J. Day, OE Core mailing list

On March 7, 2015 3:04:52 PM GMT+01:00, "Robert P. J. Day" <rpjday@crashcourse.ca> wrote:
>
>  based on a recent post to this(?) list, i was curious about the
>following loop construct in u-boot.inc:
>
>        for config in ${UBOOT_MACHINE}; do
>            for type in in ${UBOOT_CONFIG}; do
>                if [ "${type}"x = "in"x ]
>                then
>                    continue
>                fi
>
>  the words "in in" above don't appear to be a typo, as the next
>condition explicitly checks for the value "in" and skips it. what's
>the rationale for that? i used "git blame" to examine the commit that

for may barf on empty iteration input.
One usually uses for i in ${foo} '';
and skips i with zero length. Any other is obviously fine, too though so nothing wrong or odd here.

HTH,

>introduced that, but it says nothing about that curiosity.
>
>rday




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

* Re: what's with the loop with "in in" in u-boot.inc?
  2015-03-07 17:48 ` Bernhard Reutner-Fischer
@ 2015-03-08  5:04   ` Gary Thomas
  2015-03-08  8:48     ` Robert P. J. Day
  0 siblings, 1 reply; 4+ messages in thread
From: Gary Thomas @ 2015-03-08  5:04 UTC (permalink / raw)
  To: openembedded-core

On 2015-03-07 10:48, Bernhard Reutner-Fischer wrote:
> On March 7, 2015 3:04:52 PM GMT+01:00, "Robert P. J. Day" <rpjday@crashcourse.ca> wrote:
>>
>>   based on a recent post to this(?) list, i was curious about the
>> following loop construct in u-boot.inc:
>>
>>         for config in ${UBOOT_MACHINE}; do
>>             for type in in ${UBOOT_CONFIG}; do
>>                 if [ "${type}"x = "in"x ]
>>                 then
>>                     continue
>>                 fi
>>
>>   the words "in in" above don't appear to be a typo, as the next
>> condition explicitly checks for the value "in" and skips it. what's
>> the rationale for that? i used "git blame" to examine the commit that
>
> for may barf on empty iteration input.
> One usually uses for i in ${foo} '';
> and skips i with zero length. Any other is obviously fine, too though so nothing wrong or odd here.

But this code is only executed if ${UBOOT_CONFIG} is non-empty
so this test is nonsense.

My guess is that the code originally tested for ${UBOOT_CONFIG}
being empty this way, then the if/then/else was added (look at
the indentation) and the original test was never removed (which
does no harm)

>
> HTH,
>
>> introduced that, but it says nothing about that curiosity.
>>
>> rday
>
>

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


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

* Re: what's with the loop with "in in" in u-boot.inc?
  2015-03-08  5:04   ` Gary Thomas
@ 2015-03-08  8:48     ` Robert P. J. Day
  0 siblings, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2015-03-08  8:48 UTC (permalink / raw)
  To: Gary Thomas; +Cc: openembedded-core

On Sat, 7 Mar 2015, Gary Thomas wrote:

> On 2015-03-07 10:48, Bernhard Reutner-Fischer wrote:
> > On March 7, 2015 3:04:52 PM GMT+01:00, "Robert P. J. Day"
> > <rpjday@crashcourse.ca> wrote:
> > >
> > >   based on a recent post to this(?) list, i was curious about the
> > > following loop construct in u-boot.inc:
> > >
> > >         for config in ${UBOOT_MACHINE}; do
> > >             for type in in ${UBOOT_CONFIG}; do
> > >                 if [ "${type}"x = "in"x ]
> > >                 then
> > >                     continue
> > >                 fi
> > >
> > >   the words "in in" above don't appear to be a typo, as the next
> > > condition explicitly checks for the value "in" and skips it. what's
> > > the rationale for that? i used "git blame" to examine the commit that
> >
> > for may barf on empty iteration input.
> > One usually uses for i in ${foo} '';
> > and skips i with zero length. Any other is obviously fine, too though so
> > nothing wrong or odd here.
>
> But this code is only executed if ${UBOOT_CONFIG} is non-empty
> so this test is nonsense.
>
> My guess is that the code originally tested for ${UBOOT_CONFIG}
> being empty this way, then the if/then/else was added (look at
> the indentation) and the original test was never removed (which
> does no harm)

  technically, it *is* possible that UBOOT_CONFIG contains a non-empty
string of spaces so, yes, that test still has some technical value
but ... you know ... yuck. movin' 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] 4+ messages in thread

end of thread, other threads:[~2015-03-08  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-07 14:04 what's with the loop with "in in" in u-boot.inc? Robert P. J. Day
2015-03-07 17:48 ` Bernhard Reutner-Fischer
2015-03-08  5:04   ` Gary Thomas
2015-03-08  8:48     ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox