Bug 54384 - Ambiguous behavior with '--print-variables' and '--exists'
Ambiguous behavior with '--print-variables' and '--exists'
Product: pkg-config
Classification: Unclassified
Component: src
Other All
: medium normal
Assigned To: Tollef Fog Heen
Depends on:
  Show dependency treegraph
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:


Note You need to log in before you can comment on or make changes to this bug.
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.