pkg-config-0.17.1 goes into an infinite loop when the "--libs" option when
configuring some packages (I've noticed it in gnome-media and epiphany so far --
there are probably some others).
It seems to be related to repeated package names in the argument list. Here is
the simplest test case I could come up with:
pkg-config --libs glib-2.0 glib-2.0
I guess this has something to do with the new libs list pruning you do, since
the following doesn't go into an infinite loop:
pkg-config --libs --static glib-2.0 glib-2.0
The repeated package names don't need to be adjacent in the argument list.
Removing the duplicate package name in the argument list has worked around the
problem in each case I've found.
Unlike the M4 problems, this problem is going to affect people building source
Created attachment 2419 [details] [review]
Here's a patch that fixes the problem. When packages_get_l_libs() is building
dups_list, it concatenates the result of get_l_libs() for each listed package.
Now get_l_libs() returns one of the members of the Package structure, and
shouldn't be modified. But by concatenating those lists, you end up with a
cycle in the linked list.
Then when string_list_strip_duplicates_from_back() tries to simplify the list,
it has trouble when it tries to copy what seems to be an infinitely long linked
Furthermore, if string_list_strip_duplicates_from_back() completes, when you
free dups_list you'd leave invalid pointers in the various Package structures.
packages_get_L_libs() has an equivalent problem, which the patch fixes in the
2005-04-13 Tollef Fog Heen <email@example.com>
* pkg.c (packages_get_l_libs, packages_get_L_libs): Duplicate
singly linked list before putting it on list passed to
string_list_strip_duplicates_from_back to avoid infinite loop when
g_slist_copy tries to copy self-linked list. This happens if the
user specifies the same name on the command line twice.
on Mar 30, 2017 at 18:35:55.
(provided by the Example extension).