Bug 13265

Summary: [PENDING] conflicts handling is broken
Product: pkg-config Reporter: Matthias Clasen <mclasen>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: freedesktop
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: a fix

Description Matthias Clasen 2007-11-15 21:03:51 UTC
It treats RequiredVersion structs as Package structs (when calling recursive_fill_list for conflicts) and lets to segfaults. See
https://bugzilla.redhat.com/show_bug.cgi?id=384421
Comment 1 Matthias Clasen 2007-11-15 21:04:19 UTC
Created attachment 12578 [details] [review]
a fix
Comment 2 Tuc 2007-11-16 08:42:05 UTC
This fixed the SILC problem for me, but then apparently the next item it went to work with caused issues :

rarian                      Rarian - Documentation metadata access library
twolame                     twolame - An optimized MPEG Audio Layer 2 encoder
libxml-2.0                  libXML - libXML library version2.
hal-storage                 hal-storage - hal library for storage devices and vo
lumes
silc                        silc-toolkit - SILC Library
Segmentation fault (core dumped)
# gdb ./pkg-config pk*core
(etc)
#0  0x08055fd1 in g_slist_alloc () at gslist.c:127
127               current_allocator->free_lists->data = list->next;

(gdb) bt 
#0  0x08055fd1 in g_slist_alloc () at gslist.c:127
#1  0x08056100 in g_slist_prepend (list=0x0, data=0x80837c0) at gslist.c:197
#2  0x0804cc4e in _do_parse_libs (pkg=0x8080c80, argc=3, argv=0x80842c0)
    at parse.c:725
#3  0x0804cd17 in parse_libs (pkg=0x8080c80, 
    str=0x8084286 "-L${exec_prefix}/lib -lx264 -pthread", 
    path=0x8062b40 "/usr/local/libdata/pkgconfig/x264.pc") at parse.c:766
#4  0x0804d2da in parse_line (pkg=0x8080c80, 
    untrimmed=0x8084200 "Libs: -L${exec_prefix}/lib -lx264 -pthread", 
    path=0x8062b40 "/usr/local/libdata/pkgconfig/x264.pc", ignore_requires=1, 
    ignore_private_libs=1) at parse.c:982
#5  0x0804d5c3 in parse_package_file (
    path=0x8062b40 "/usr/local/libdata/pkgconfig/x264.pc", ignore_requires=1, 
    ignore_private_libs=1) at parse.c:1117
#6  0x08049b91 in internal_get_package (name=0x80642c0 "x264", warn=1, 
    check_compat=1) at pkg.c:352
#7  0x08049d1d in get_package (name=0x80642c0 "x264") at pkg.c:399
#8  0x0804b785 in packages_foreach (key=0x80642c0, value=0x8062b40, data=0x1c)
    at pkg.c:1485
#9  0x08052e45 in g_hash_table_foreach (hash_table=0x8061160, 
    func=0x804b774 <packages_foreach>, user_data=0x1c) at ghash.c:300
#10 0x0804b835 in print_package_list () at pkg.c:1508
#11 0x0804f061 in main (argc=2, argv=0xbfbfe8bc) at main.c:441

If I move the silc.pc out of the way, it keeps going but then stops again :

OpenEXR                     OpenEXR - OpenEXR image library
wavpack                     wavpack - wavpack library
firefox-gtkmozembed         Mozilla Gtk Embedding Widget - Mozilla Embedding Widget for Gtk+
libgnomecanvas-2.0          libgnomecanvas-2.0 - libgnomecanvas
silcclient                  silc-toolkit (client library) - SILC Client Library
Segmentation fault (core dumped)

# gdb ./pkg-config pk*core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
Core was generated by `pkg-config'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.5...done.
Loaded symbols for /lib/libc.so.5
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x2813480f in strncmp () from /lib/libc.so.5

(gdb) bt
#0  0x2813480f in strncmp () from /lib/libc.so.5
#1  0x0804a7e4 in verify_package (pkg=0x8097a00) at pkg.c:889
#2  0x08049cc6 in internal_get_package (name=0x8061360 "cairo-xlib-xrender", 
    warn=1, check_compat=1) at pkg.c:386
#3  0x08049d1d in get_package (name=0x8061360 "cairo-xlib-xrender")
    at pkg.c:399
#4  0x0804b785 in packages_foreach (key=0x8061360, value=0x8069900, data=0x1c)
    at pkg.c:1485
#5  0x08052e45 in g_hash_table_foreach (hash_table=0x8061160, 
    func=0x804b774 <packages_foreach>, user_data=0x1c) at ghash.c:300
#6  0x0804b835 in print_package_list () at pkg.c:1508
#7  0x0804f061 in main (argc=2, argv=0xbfbfe8bc) at main.c:441

Comment 3 Tuc 2007-11-16 08:53:08 UTC
OR.... The patch wasn't applied cleanly... :(

Sorry to bother everyone.
Comment 4 Tollef Fog Heen 2007-12-29 08:26:21 UTC
2007-12-29  Tollef Fog Heen  <tfheen@err.no>

	* pkg.c (verify_package): Apply patch from Matthias Clasen of
	RedHat to prevent segfaults if a Conflicts line is encountered.

Comment 5 Tollef Fog Heen 2009-12-06 13:46:30 UTC
This has been fixed in 0.23, so closing this bug now.

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.