]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
makesyscalls.lua: improve config processing
authorkevans <kevans@FreeBSD.org>
Fri, 6 Dec 2019 22:45:36 +0000 (22:45 +0000)
committerkevans <kevans@FreeBSD.org>
Fri, 6 Dec 2019 22:45:36 +0000 (22:45 +0000)
commit590f666c03f001757e59dce936ef61d11f086c91
tree978277e1d956dd8d3e27860a2912a701283aace8
parent57fa8b904fbee39035a37f33fd247523ce7f78ac
makesyscalls.lua: improve config processing

The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways:

- Strip only whole-line comments on every single iteration
- Abort if we see a malformed line that doesn't match the key=value format
- For quoted (backtick or double quote) strings, we'll advance to the end of
  the key=value pair and make sure there's not extra stuff left over
- For unquoted key=value pairs, we'll strip any trailing comments and verify
  there's no internal whitespace

This has revealed the caveat that key/value pairs can't even include escaped quotes (and haven't been able to). I don't know if this is actually problematic, as we're usually looking at cases like "#include <foo>" or raw identifiers.The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways:

Reviewed and noticed by: brooks
Differential Revision: https://reviews.freebsd.org/D22698
sys/tools/makesyscalls.lua