mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Frank Wunderlich <frank-w@public-files.de>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: Re: Re: barebox extending boot-scripts
Date: Mon, 31 Jan 2022 12:03:15 +0100	[thread overview]
Message-ID: <20220131110315.GE23490@pengutronix.de> (raw)
In-Reply-To: <trinity-eba130ad-1bd5-46a1-95bd-4a2ee29c1f96-1643452807981@3c-app-gmx-bs07>

Hi Frank,

On Sat, Jan 29, 2022 at 11:40:08AM +0100, Frank Wunderlich wrote:
> Hi,
> > Gesendet: Donnerstag, 06. Januar 2022 um 09:08 Uhr
> > Von: "Sascha Hauer" <sha@pengutronix.de>
> 
> > It works for example with:
> >
> > for i in /mnt/sd.1/extlinux/Image*; do basename $i b; echo $b; done
> 
> this works with full path, but not if using a var for dir var
> 
> barebox@BPI R2PRO:/ i=0;for f in /mnt/sd.1/extlinux/Image*; do basename $f b; echo "$i:$b";let i++; done
> 0:Image_5.16
> 1:Image_5.16-next.gz
> 2:Image_5.16.gz
> 3:Image_5.16.gz.bak
> 4:Image_5.16_q64
> 5:Image_bpi
> barebox@BPI R2PRO:/ imgdir=/mnt/sd.1/extlinux/
> barebox@BPI R2PRO:/ i=0;for f in $imgdir/Image*; do basename $f b; echo "$i:$b";let i++; done

You've hit yet another hush bug. Normally when you do a

# foo="bar baz"
# for i in $foo; echo $i; done
bar
baz

$foo expands to two words. This works as expected.

This also works with:

# for i in *; do echo $i; done
dev
env
foo
mnt
tmp

Using a combination of glob pattern and variable however does not work:

# foo="*"
# for i in $foo; do echo $i; done
dev env foo mnt tmp

hush inserts the expanded glob pattern of "*" as a single word into the
parsing data, so i doesn't contain the separated words, but instead "dev
env foo mnt tmp" at once.

There are many bugs like this in hush and we've fixed several of them,
possibly inserting other bugs along the way. I've starred on the code
for a long time over the years and still don't fully understand it. When
changing things I'm often not sure about its implications. To put it
shortly: hush is broken beyond repair.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2022-01-31 11:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 15:20 Frank Wunderlich
2022-01-05 16:07 ` Ahmad Fatoum
2022-01-05 18:13   ` Aw: " Frank Wunderlich
2022-01-06  8:08     ` Sascha Hauer
2022-01-06 12:41       ` Aw: " Frank Wunderlich
2022-01-07 13:07         ` Sascha Hauer
2022-01-07 16:42           ` Aw: " Frank Wunderlich
2022-01-10  9:42             ` Sascha Hauer
2022-01-15 13:47               ` Aw: " Frank Wunderlich
2022-01-17  8:59                 ` Sascha Hauer
2022-01-29 10:40       ` Aw: " Frank Wunderlich
2022-01-31 11:03         ` Sascha Hauer [this message]

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=20220131110315.GE23490@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=frank-w@public-files.de \
    /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