[Bug 376022] Re: pkg-config doesn't cope well with faulty .pc files

Bug Watch Updater 376022 at bugs.launchpad.net
Sun Aug 2 23:46:23 UTC 2015


Launchpad has imported 4 comments from the remote bug at
https://bugs.freedesktop.org/show_bug.cgi?id=76791.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2014-03-30T12:49:11+00:00 Tsrdel wrote:

Created attachment 96614
Implement parser control logic in place of exit() when error occurs

pkg-config's parser control logic seems to be pretty simple - any
serious error in parsed package description and pkg-config outputs
descriptive error message and exits. The exit() calls are used
internally in many places in parser.

Unfortunately such an approach causes --list-all command to stop outputting data as soon as any serious error in one of the listed packages is found. 
This is something rather unexpected - no one probably expects shortened packages listing where the only assumption if the package will be listed or not is if the package would be listed before or after erroneus package.

I would suggest two solutions:

1) first scan & parse all packages' .pc files and if any error occurs only print out error message with information which package caused error - if no error occured during parsing print out packages' description in format of '--list-all' command.
The approach seems to be simpler to implement and could be clearer indication that something is wrong with .pc files in one or more of scanned directories.

2) scan and output info about all .pc files which doesn't cause problems
to stdout and descriptive errors to stderr about the packages which are
not linkable because of errors in their .pc files.

The approach has the advantage that all the working .pc files are listed in --list-all commands and the possible trashes don't cause the software to work.
And --list-all command is possibly very useful for IDEs to get information which packages are available in the system to handle external dependiences (valama ide is one of such IDEs ).

I've implemented solution for the (2) - patch included for 0.28. The patch changes all exit() calls in parser to graceful returns with checks in callers if some problems occured to skip the package.
'make check' performed - all 25 tests successful.

The patch applies cleanly against 0.28 - with current git master it
applies with 'offset 1 line'.

The remaining issue is exit status of pkg-config when error during
parsing of one of the .pc files - before it was '1' and after the patch
applied it is '0'.

Reply at: https://bugs.launchpad.net/ubuntu/+source/pkg-
config/+bug/376022/comments/1

------------------------------------------------------------------------
On 2014-06-07T18:08:52+00:00 Daniel Macks wrote:

I agree that the problem is visible (took me a while to recognize it
while trying to debug other builds, and also while hacking pkg-config
itself), and that solution #2 is a good one. Pushing a solution to Bug
#7000 would allow authors to avoid installing broken .pc (or at least
package-manager maintainers to catch and fix rather than redistributing
them that way:).

Reply at: https://bugs.launchpad.net/ubuntu/+source/pkg-
config/+bug/376022/comments/2

------------------------------------------------------------------------
On 2014-06-18T04:33:03+00:00 Daniel Macks wrote:

Is this a dup of Bug #26615? That one is closed with a fix committed to
git, but not yet available in a released new version.

Reply at: https://bugs.launchpad.net/ubuntu/+source/pkg-
config/+bug/376022/comments/3

------------------------------------------------------------------------
On 2014-06-18T09:22:19+00:00 Tsrdel wrote:

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 at 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.

Ps. I've sent the comment also to linked bug report

Reply at: https://bugs.launchpad.net/ubuntu/+source/pkg-
config/+bug/376022/comments/4


** Changed in: pkg-config
       Status: Unknown => Confirmed

** Changed in: pkg-config
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to pkg-config in Ubuntu.
https://bugs.launchpad.net/bugs/376022

Title:
  pkg-config doesn't cope well with faulty .pc files

Status in pkg-config:
  Confirmed
Status in pkg-config package in Ubuntu:
  Triaged

Bug description:
  Binary package hint: pkg-config

  see bug #376017 pkg-config could not list my library due to to
  glipper.pc having a faulty .pc file error message complained about
  glipper.pc having no Name field, as a result it would not list my lib
  I fixed glibber.pc and the problem went away, so pkg-config is buggy
  should cope better with errors like this

To manage notifications about this bug go to:
https://bugs.launchpad.net/pkg-config/+bug/376022/+subscriptions



More information about the foundations-bugs mailing list