grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Syntax checker for GRUB script config file


From: BVK Chaitanya
Subject: Re: [PATCH] Syntax checker for GRUB script config file
Date: Sun, 6 Dec 2009 18:41:18 +0530

On Fri, Dec 4, 2009 at 9:42 PM, Robert Millan <address@hidden> wrote:
> On Fri, Dec 04, 2009 at 07:12:12AM +0000, BVK wrote:
>>
>> Attached patch (experimental) adds a new tool, grub-script-check, that
>> can be used to check grub.cfg file syntax.  Idea is to use this tool
>> during update-grub to catch any syntax errors and reject the update.
>
> Excellent idea.


Thank you. This was requested by Felix, so credit goes to him too :-)


>
>> As part of this tool, I found few bugs in parser.y script and is
>> updated as necessary.
>
> Could you send this as a separate patch?
>

Attached patch is only for parser code, that is much richer and has
fixes for few more parsing cases.  For example, old parser doesn't
accept commands like, "echo if" because 'if' is a keyword, etc.

There are few cases, where this parser fails because handcoded lexer
is sending wrong inputs (eg: try "function foo { true; }" in single
line); I am thinking of replacing it with flex generated lexer and I
will try to fix these cases there.  Is that okay?

As a side note, since minor changes in grammar rules can have
unexpected side effects, I suggest to commit this only after having
proper unit tests.  Since we now have a syntax checker tool
(grub-script-check) that can be run at make-check-time, I am planning
to write some scripted testcases (based on unit-testing framework
patches I sent earlier), that would ensure parser changes do not break
already working grub-scripts.

Let me know your comments.




thanks
-- 
bvk.chaitanya

Attachment: parser-bug-fixes.patch.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]