-
Notifications
You must be signed in to change notification settings - Fork 359
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
Relax warning 41 for package variables guarded by a :installed filter #5927
Conversation
@kit-ty-kate rightly points out a timing issue which concretely invalidates one of the test cases. The filter above should repeat the guard of the dependency, i.e. instead of:
it should be:
this also concretely rules out this line from the test:
since I'm wondering if this is in fact more related to #5928 - in order to use the variables, we need both that it's unequivocally guarded by Regardless, the test case of |
Additional commit added which tweaks the check slightly. Now:
|
The warnings emitted for guarded-dependency and no-dependency-guarded are not strictly necessary as they are protected by a filter which checks :installed (:installed at present never triggers warning 41). The warning for no-dependency-unguarded is unequivocally correct.
Warning 41 is never triggered for the use of package:installed. Extend this so that the warning is not triggered for any uses of package:foo _underneath_ package:installed, i.e. "%{package:foo}% {package:installed} can no longer cause warning 41 on package.
The previous change means that a variable will definitely not be expanded unless the package has been installed. However, there is a timing issue which is not desirable - there is no guarantee that if either no-dependency-guarded or no-dependency-installed-only have been installed that they will be installed before or after the current package. This instability is not desirable, either. The check is therefore enhanced slightly so that foo:installed can only be used if depends or depopts in some way mentions the package (rather than doing a full tautology check on depends for whether foo is installed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The compiler packages contain the following snippet:
but the use of
flexdll:share
triggers lint warning 41 because the flexdll dependency is guarded byos
. However, this warning is a bit obtuse given the argument is guarded byflexdll:installed
(and:installed
explicitly doesn't trigger lint warning 41).This PR alters lint warning 41 so that when it evaluates the list of variables used in commands, it scans the filters for instances of
package:installed
and then performs a partial evaluation of the filter with thatpackage:installed
variable explicitly set to false (but nothing else set in the environment). If the filter reduces tofalse
, then all instances ofpackage:var
guarded by the filter are ignored.The first commit adds a test case showing the present behaviour, then the fix shows two of the packages warned being eliminated.