* Bug in gencmdlist.sh (or is it?)
@ 2009-07-01 22:34 Duboucher Thomas
2009-07-02 1:14 ` Pavel Roskin
0 siblings, 1 reply; 4+ messages in thread
From: Duboucher Thomas @ 2009-07-01 22:34 UTC (permalink / raw)
To: grub-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I was working on some Grub2 module a few days ago and I spent a lot of
time on this. Basically, I was unable to correctly generate the file
command.lst; my new commands simply didn't appeared in it.
I finally found that gencmdlist.sh is only processing line per line
using sed, so that if one is writing with a different indentation, the
script silently fail. For instance,
> grub_extcmd
> (
> "foo",
does not produce any output. I am working now with a small script
written in Lua, but it is neither efficient, nor a good idea to add Lua
as a dependency. Perhaps a sed guru can have a look at this?
Thomas.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkpL5HwACgkQBV7eXqefhqg3hwCfX4Fn6icORyZKygqZJo1eqwWH
LSAAnjUCLniZX9pu0OCp4CV7EEjNXAp7
=AKuH
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in gencmdlist.sh (or is it?)
2009-07-01 22:34 Bug in gencmdlist.sh (or is it?) Duboucher Thomas
@ 2009-07-02 1:14 ` Pavel Roskin
2009-07-02 5:42 ` Duboucher Thomas
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2009-07-02 1:14 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, 2009-07-02 at 00:34 +0200, Duboucher Thomas wrote:
> I was working on some Grub2 module a few days ago and I spent a lot of
> time on this. Basically, I was unable to correctly generate the file
> command.lst; my new commands simply didn't appeared in it.
> I finally found that gencmdlist.sh is only processing line per line
> using sed, so that if one is writing with a different indentation, the
> script silently fail. For instance,
> > grub_extcmd
> > (
> > "foo",
> does not produce any output.
I confirm that it's indeed a limitation of gencmdlist.sh. It may be
possible to handle it by using C preprocessor before sed, but I don't
think it's an urgent issue. It's shouldn't be a problem for properly
indented source.
> I am working now with a small script
> written in Lua, but it is neither efficient, nor a good idea to add Lua
> as a dependency.
I don't understand how this is related.
> Perhaps a sed guru can have a look at this?
I actually don't feel good about using anything other that a C compiler
or preprocessor to parse C sources.
It's working for now, but if we want to make it more reliable, I'd
rather not ask a "sed guru".
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in gencmdlist.sh (or is it?)
2009-07-02 1:14 ` Pavel Roskin
@ 2009-07-02 5:42 ` Duboucher Thomas
2009-07-04 5:07 ` Pavel Roskin
0 siblings, 1 reply; 4+ messages in thread
From: Duboucher Thomas @ 2009-07-02 5:42 UTC (permalink / raw)
To: The development of GRUB 2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pavel Roskin a écrit :
> On Thu, 2009-07-02 at 00:34 +0200, Duboucher Thomas wrote:
>
>> I was working on some Grub2 module a few days ago and I spent a lot of
>> time on this. Basically, I was unable to correctly generate the file
>> command.lst; my new commands simply didn't appeared in it.
>> I finally found that gencmdlist.sh is only processing line per line
>> using sed, so that if one is writing with a different indentation, the
>> script silently fail. For instance,
>>> grub_extcmd
>>> (
>>> "foo",
>> does not produce any output.
>
> I confirm that it's indeed a limitation of gencmdlist.sh. It may be
> possible to handle it by using C preprocessor before sed, but I don't
> think it's an urgent issue. It's shouldn't be a problem for properly
> indented source.
No, it is not really urgent. As I said, I have already found a
workaround. But based on Grub2 being a module-based project, I don't
think an indentation-dependant parser is a good idea, nor is it robust.
>
>> I am working now with a small script
>> written in Lua, but it is neither efficient, nor a good idea to add Lua
>> as a dependency.
>
> I don't understand how this is related.
>
I have replaced gencmdlist.sh by a script in Lua that does the same, and
can handle any kind of indentation - or at least the resulting file is
identical even if I mess the indentation; but based on how and when I
have writen it, well, I'm not very confident ;) -.
>> Perhaps a sed guru can have a look at this?
>
> I actually don't feel good about using anything other that a C compiler
> or preprocessor to parse C sources.
>
> It's working for now, but if we want to make it more reliable, I'd
> rather not ask a "sed guru".
>
There are tools to parse source code, but that is not my domain. That's
the reason I was reporting this. :)
Regards,
Thomas.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkpMSM8ACgkQBV7eXqefhqgzGwCcD5cXmwsCREdwNUBjgvACc9xK
xxoAoLIBToOcZ5oig5T/ihd9av/wioed
=6XCt
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in gencmdlist.sh (or is it?)
2009-07-02 5:42 ` Duboucher Thomas
@ 2009-07-04 5:07 ` Pavel Roskin
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Roskin @ 2009-07-04 5:07 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, 2009-07-02 at 07:42 +0200, Duboucher Thomas wrote:
> No, it is not really urgent. As I said, I have already found a
> workaround. But based on Grub2 being a module-based project, I don't
> think an indentation-dependant parser is a good idea, nor is it robust.
I agree.
> >> I am working now with a small script
> >> written in Lua, but it is neither efficient, nor a good idea to add Lua
> >> as a dependency.
> >
> > I don't understand how this is related.
> >
>
> I have replaced gencmdlist.sh by a script in Lua that does the same, and
> can handle any kind of indentation - or at least the resulting file is
> identical even if I mess the indentation; but based on how and when I
> have writen it, well, I'm not very confident ;) -.
I think an improved approach would be one of those:
1) Make gencmdlist.sh call cpp with a special macro, that would expand
into something that can be reliably extracted by sed or grep and placed
into command.lst.
2) Use a macro to write the symbol into a special linker section.
gencmdlist.sh would read it to generate command.lst at the build time.
3) Use a macro to write the symbol into a special linker section.
grub-install would run a new utility to generate command.lst from the
modules in /boot/grub.
The later is very appealing, but it would be a big change in the way we
are doing things.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-04 5:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01 22:34 Bug in gencmdlist.sh (or is it?) Duboucher Thomas
2009-07-02 1:14 ` Pavel Roskin
2009-07-02 5:42 ` Duboucher Thomas
2009-07-04 5:07 ` Pavel Roskin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.