Bug 26615

Summary: pkg-config 0.23 should not exit on parse errors when using --list-all
Product: pkg-config Reporter: Hans de Graaff <hans>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: djcb.bulk
Version: unspecified   
Hardware: All   
OS: All   
URL: https://bugs.gentoo.org/show_bug.cgi?id=284974
See Also: http://bugs.debian.org/611563
Whiteboard:
i915 platform: i915 features:

Description Hans de Graaff 2010-02-17 12:29:42 UTC
pkg-config 0.23 exits immediately when encountering a parse error in trim_and_sub(), e.g. if a .pc files misses a required variable.

When using --list-all this is quite unfortunate, since the advertised use of --list-all is to list all installed packages, not only those before a bad package file is encountered.

This is a problem at least for ruby-gnome2 which wraps pkg-config in a ruby interface, using pkg-config with the --list-all option to learn about installed packages.

A good solution would be to write out an error to STDERR and not include the broken package in the output list of --list-all.
Comment 1 Rodrigo Silva 2013-05-09 13:46:32 UTC
*** Bug 28609 has been marked as a duplicate of this bug. ***
Comment 2 Rodrigo Silva 2013-05-09 13:51:18 UTC
Still present in at least 0.26
Comment 3 Dan Nicholson 2013-05-17 12:56:43 UTC
Fixed in 715cc30.
Comment 4 Tadeusz Szczyrba 2014-06-18 09:21:24 UTC
For the mentioned previous bug report there is a closing comment that commit 715cc30 fixes it, but when I checked the commit the parser exists as before in case of some heavier error in .pc file during '--list-all' command execution.

Tests results of pkg-configs with simulated error (.pc without Name: tag):

[commit 715cc30:]
./pkg-config --list-all | wc -l

(pkg-config:9743): GLib-CRITICAL **: g_string_append: assertion 'val != NULL' failed
449

[patched 0.28 with my patch applied:]
trevor@trevhomepc:/usr/local/src/pkg-config/pkg-config> pkg-config --list-all | wc -l
Variable 'libjpeg_prefix' not defined in '/usr/lib/pkgconfig/libgdiplus.pc'
Package 'gnome-icon-theme' has no Name: field
720

When the commit 715cc30 fixes something, it doesn't solve all problems with incorrectly prepared .pc files in pkg-config database in scope of '--list-all' command,

regards,

T.

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.