Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kconfiglib: check empty strings on macro expansion #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leandrolanzieri
Copy link

During macro expansion, bare macros on a line are accepted by the parser as long as they resolve to blank strings. The problem is that the script is currently checking using isspace, so it's actually not checking for blank strings.

This causes the parsing to fail when a macro is the last line of a file, and no newline character is added afterwards. This patch adds a check for the string itself being empty.

This can be tested, for instance, by applying the following and running the tests:

diff --git a/tests/Kpreprocess b/tests/Kpreprocess
index 283a988..a30ba74 100644
--- a/tests/Kpreprocess
+++ b/tests/Kpreprocess
@@ -149,3 +149,5 @@ env_ref_3 += $(ENV_4)
 $(warning-if,$(ENV_5),$(ENV_UNDEFINED))
 source "$(ENV_6)"
 env_ref_4 = $(ENV_7)  # Never evaluated
+
+$(info,Information message)
\ No newline at end of file

Originally ulfalizer/Kconfiglib#99.

During macro expansion, bare macros on a line are accepted by the parser
as long as they resolve to blank strings. The problem is that the script
is currently checking using isspace, so it's actually not checking for
blank strings.

This causes the parsing to fail when a macro is the last line of a file,
and no newline character is added afterwards. This patch adds a check for
the string itself being empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant