Re: [PATCH] ifupdown: make parser for /etc/network/interfaces more robust

On Sun, 2010-08-08 at 15:12 +0200, Peter Marschall wrote:
> Hi,
> the previous implementation of the parser for /etc/network/interfaces had
> quite a few drawbacks:
> - it expected the lines to be terminated with "\n", even the last line
> - it ignored line wraps with "\\" followed by "\n"
> - it expected over-long lines to be shorter than 510 characters
> - it ignored line wraps on over-long lines
> - it treated spaces and tabs differently
> - it did not make sure to really tokenize on word boundaries
> - it treated the equivalent stanzas "auto" and "allow-auto" differently
> - it ignored the fact that the "allow-*" stanzas can take multiple arguments
>   that need to be separated to be recognized NetworkManager's processing later
> - it allowed "non-block" stanzas to appear before a block
> The attached patch is a rewrite of the parser to fix the issues mentioned:
> - it accepts the last line even if it is not terminated by "\n"
> - it skips over-long lines, emits a warning and even takes int account
>   that over-long lines may be wrapped to next lines
> - it un-wraps wrapped lines
> - it uses spaces and tabs equivalently to tokenize the input
> - it treats "allow-auto" as a synonym to "auto"
> - it splits multi-argument "auto"/"allow-*" stanza into multiple
>   single-argument stanzas of the same type
> - it warns on data stanzas before the first block stanza
> Signed-off-by: Peter Marschall <peter adpm de>


Thanks for the patch!  Is there any chance you could provide some
testcase /e/n/i files that are now expected to work with your rewrite,
but which did not work before?  I'd like to start building up the
testsuite for ifupdown.


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