Repository navigation
scanner: don't drop or echo lone backslashes in @include paths - #317
Open
affan-arch wants to merge 1 commit into
Open
affan-arch wants to merge 1 commit into
affan-arch wants to merge 1 commit into
Conversation
The INCLUDE start condition only has rules for the \\ and \" escapes, so a backslash followed by any other character, as in @include "conf.d\extra.cfg" or a Windows path like @include "C:\cfg\app.cfg", matches nothing and falls through to flex's default rule. That rule ECHOes the byte to yyout, which is the host process's stdout, and leaves it out of the path. config_read_file() and config_read_string() then write config-controlled bytes to the application's stdout and open a different file than the one named: conf.dextra.cfg, or on Windows C:cfgapp.cfg, a drive-relative path resolved against the process's current directory. Keep a lone backslash literally, as the STRING state already does with its own \\ rule. With this rule in place, flex -s no longer reports that the default rule can be matched. scanner.c and scanner.h are regenerated with flex 2.6.4. The new IncludePathBackslash test fails without the fix.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
inside
@include "..."the scanner only has rules for\\and\", so a lone backslash as in@include "conf.d\extra.cfg"or a windows path likeC:\cfg\app.cfgfalls through to flex's default rule, which echoes it to the application's stdout and drops it from the path, soconfig_read_file()/config_read_string()openconf.dextra.cfg(or the drive-relativeC:cfgapp.cfg) instead of what was written; the docs do ask for\\there, but a missed escape shouldn't print to stdout or quietly swap the file, so it's now kept literally the way<STRING>\\already handles it,flex -sno longer reports a reachable default rule,scanner.c/scanner.hare regenerated with flex 2.6.4 (regenerating master reproduces the checked-in files byte for byte, so that diff is only the new rule), and the newIncludePathBackslashtest fails without the fix.