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

AllowSubstExceptions may clash with some predefined macros #4516

Open
mwichmann opened this issue Apr 18, 2024 · 1 comment
Open

AllowSubstExceptions may clash with some predefined macros #4516

mwichmann opened this issue Apr 18, 2024 · 1 comment
Labels
documentation subst Problems with quoting, substitution

Comments

@mwichmann
Copy link
Collaborator

mwichmann commented Apr 18, 2024

This issue comes from the mailing list thread at https://pairlist4.pair.net/pipermail/scons-users/2024-April/009346.html

Some of the default values of macro-like construction variables depend on the behavior that, when substituted, a token representing a variable not defined in the construction environment is replaced with an empty string. This is used to provide conditional inclusion in a relatively concise manner. However, this empty-string token replacement is itself conditional: it only takes place if the exception raised when accessing an undefined variable is one listed in the AllowableExceptions list in the Subst module. That list is settable via the public API AllowSubstExceptions. If the list is cleared, so the user can detect the usage of undefined variables in the build, then an exception is raised instead, and this can break things. The substitution methods try to do the right thing here, but there is an extra factor: sometimes there's a callable object involved, and those need to respect the rules too.

It is possible - investigation pending - that the scope of the problem is limited to the case outlined in the mailing list thread: the two functions __libversionflags and __lib_either_version_flag, which return None rather than an empty string. At a brief glance, no other function in the SCons core used in this kind of variable expansion can return None. I don't see where we say anywhere that "don't return None" is a requirement, but it's worth checking whether that should be a rule, and these two functions fixed to return empty string. Again... some more digging required.

@mwichmann mwichmann added subst Problems with quoting, substitution documentation labels Apr 21, 2024
@mwichmann
Copy link
Collaborator Author

Adding the documentation tag, maybe we should say something about the rules involved, though it's not clear what form such a doc addition would take yet.

@mwichmann mwichmann changed the title AllowSubstExceptions may clash with some predefined macros AllowSubstExceptions may clash with some predefined macros Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation subst Problems with quoting, substitution
Projects
None yet
Development

No branches or pull requests

1 participant