pkg-config doesn't cope well with faulty .pc files
Bug #376022 reported by
Grizzly(Francis Smit)
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pkg-config |
Unknown
|
Medium
|
|||
pkg-config (Ubuntu) |
Triaged
|
Low
|
Unassigned |
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
Changed in pkg-config: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in pkg-config: | |
status: | Confirmed → Unknown |
To post a comment you must log in.
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'.