From: Tobias Geerinckx <tobias.geerinckx@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Weird bug about wildcard behavior in for statement
Date: Sun, 1 Jun 2014 00:22:44 +0000 [thread overview]
Message-ID: <CAGKnN_B0B+4U_7iCx9Kq209cb6eoaFbAnBXP1azysPy9rGzVsg@mail.gmail.com> (raw)
In-Reply-To: <CAD=SU=eQLV=Kda-nT2V7tm_Wj2FJX164exZKK+hsHehjE5qrqQ@mail.gmail.com>
On 31 May 2014 13:55, Z C <zcnnbb@gmail.com> wrote:
> I am currently using grub version 2.02 beta 2 got from git
>
> In the grub command shell, if the first command I execute is
>
> for i in /*; do echo $i; done
>
> What I expect is the file/directory list of my $root partition. But the
> result is just /* itself
Unless you've omitted an implied 'insmod regexp', this is correct.
The regexp module hasn't been loaded, so globbing is unavailable.
> Then if I execute the second command
>
> for i in /*; do echo $i; regexp '' $i; done
>
> I got the same result: /*
>
> And if I execute the second command again, the result varies and I got the
> file list as what I expected at the beginning.
Ah, but you've implicitly loaded the regexp module inside the loop.
Any subsequent commands will now behave as if
grub> insmod regexp
was executed.
> Then if I execute the first command again, the result is still the file
> list.
>
> This test really shocked me, because the same command may produce different
> result randomly. I really wonder what is the intended behavior of *
> character in for statement
That depends on what you want it to do:
- If you want pattern matching, insert the regexp module.
- If you don't, remove it.
This is neither random nor a bug; it's GRUB doing exactly what you ask.
Regards,
Tobias (hoping Gmail doesn't suck as royally as it probably does)
prev parent reply other threads:[~2014-06-01 0:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-31 13:55 Weird bug about wildcard behavior in for statement Z C
2014-06-01 0:22 ` Tobias Geerinckx [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=CAGKnN_B0B+4U_7iCx9Kq209cb6eoaFbAnBXP1azysPy9rGzVsg@mail.gmail.com \
--to=tobias.geerinckx@gmail.com \
--cc=grub-devel@gnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).