Skip to content

Conversation

@dmoody256
Copy link
Contributor

from discord chat: https://discord.com/channels/571796279483564041/971831743944491008/983467680201863329

It was found that if the root dir was under a spaced dir, the lex emitter would not respect the escaped spaces via the use of subst call followed by iterating the CLVar of the returned subst string. CLVar class documents that it must be passed a list to respect spaces.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt (and read the README.rst)
  • I have updated the appropriate documentation

@mwichmann mwichmann added the Tools Issues related to tools subsystem label Jun 14, 2022
@mwichmann mwichmann changed the title Updated lex emitter to respect escaped spaces when climbing out of a the SCosncript dir Updated lex emitter to respect escaped spaces when climbing out of the SConscript dir Jun 14, 2022
…cally what's fixed. Address a few lint issues in the lex.py file
@bdbaddog bdbaddog merged commit 4973db5 into SCons:master Jun 25, 2022
@mwichmann mwichmann added this to the 4.4 milestone Jun 25, 2022
@mwichmann
Copy link
Collaborator

mwichmann commented Jun 26, 2022

It looks like this breaks the argument processing later in the emitter, because now we have a list-of-lists, not a list... these options are no longer recognized:

file_gen_options = ["--header-file=", "--tables-file="]

Update: it appears the problem is if both file-gen flags are supplied, it's fine with just one (as indicated by the testcase that was added here). Still investigating.

mwichmann added a commit to mwichmann/scons that referenced this pull request Jun 30, 2022
The mocked tools mylex.py and myyacc.py now understand the file-generation
options, and generate a dummy file with predictable contents, for
checking.  This allows more testing of the path through the SCons support
for these two without needing live commands.

New tests added which invoke the file-generation options, and make
sure the extra files are created, and that SCons detects and tracks
the added targets.  Work is done in a subdirectory, which exposes some
existing known inconsistent behavior (the regular generated file goes
in the subdir per the LEXCOM and YACCOM generated line, while the ones
generated from commandline options go in the topdir) - but we're going
to allow that behavior to continue for backwards compat.

Same fix applied to yacc tool that PR SCons#4168 did for lex - do subst_list()
instead of subst() to preserve spaces in paths.  That fix left the lex
tool unable to pass the new test, as it could not see the individual
arguments in the FLAGS variable, which was solved by indexing into the
subst'd list so we can iterate over the args again.

Test and tool cleanup; add DefaultEnvironment calls, etc.

Note this mentions, but does not address the problem described in issue 4154.

Signed-off-by: Mats Wichmann <[email protected]>
@mwichmann
Copy link
Collaborator

Just to close the loop in case anyone is prospecting, a simple index into the subst_list result restores the functionality of being able to iterate through the components of the flag in case there are multiple flags in a single string in LEXFLAGS. The changes in #4183 make this change, as well as adding a test case for that situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tools Issues related to tools subsystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants