Bug 54384

Summary: Ambiguous behavior with '--print-variables' and '--exists'
Product: pkg-config Reporter: Michał Górny <mgorny>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

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.