Bug 54384 - Ambiguous behavior with '--print-variables' and '--exists'
Summary: Ambiguous behavior with '--print-variables' and '--exists'
Status: RESOLVED FIXED
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Tollef Fog Heen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-02 11:05 UTC by Michał Górny
Modified: 2012-10-31 01:02 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Michał Górny 2012-09-02 11:05:23 UTC
The '--exists' option in pkg-config causes it to check the package dependency graph and exit silently, even if options like '--libs' are specified.

Similarly, '--list-all' option causes pkg-config to output the package list and exit even if other ('later') options are specified.

However, the '--print-variables' option doesn't follow either behavior. Most importantly, when used with '--exists', pkg-config first prints all the variables, and then exits with '--exists' result; but when used with other options like '--libs', it outputs both the variable list and other option output.

I think the '--print-variables' option should either follow suite of 'exiting' options or the regular output ones. For the former, it would need an exit(0) after outputting the variable list; for the latter, it would need to be moved after 'want_exists' conditional.

If you aren't interested in fixing this, please at least tell me which behavior is more correct in your opinion.
Comment 1 Dan Nicholson 2012-10-31 01:02:09 UTC
I fixed it the easy way in commit d6a1448 by just moving it after the wants_exists handling. The whole option handling needs a full sweep so options exit when they're done if they don't make sense to be used with other options. This just maintains the status quo, though.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.