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

Preprocessor condition <?if $(var.A) ?> is always true regardless of the value of A #4770

Closed
wixbot opened this issue May 21, 2015 · 3 comments · Fixed by wixtoolset/wix#133

Comments

@wixbot
Copy link

wixbot commented May 21, 2015

If you use a pre-processor condition in the form of <?if $(var.A) ?>, the condition always evaluates to true regardless of the value of A. For example:

<?define A='0' ?>
.
<?if $(var.A) ?>
.
.  Content always included
.
<?endif ?>

Should an atomic expression (with no value on the RHS of the expression) coerce the LHS value to a Boolean? In this situation could strings like '0', 'False', or 'No' be equivalent to Boolean False?

Relevant area of the WIX code base is EvaluateAtomicExpression() in src\tools\wix\Preprocessor.cs.

Unsure whether this is a bug, or a feature request.

Originally opened by rbradford

@wixbot
Copy link
Author

wixbot commented Jun 2, 2015

Release changed from v3.9 to v4.0

@wixbot
Copy link
Author

wixbot commented Jun 3, 2015

Type changed from Bug to Feature

@wixbot wixbot added this to the v4.0 milestone Dec 20, 2015
@barnson barnson added the triage label Jun 6, 2021
@barnson
Copy link
Member

barnson commented Jun 10, 2021

Per triage team: We should not coerce to booleans. <?ifdef?> exists and comparisons to explicit values are supported. So a "naked" variable reference should be an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants