pkgconf / pkgconf

package compiler and linker metadata toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with PKG_CONFIG_PATH resolving past 2.0.0

1480c1 opened this issue · comments

Steps to reproduce:

  1. Prep two hypothetical prefixes (could be a local install and the normal /usr/lib/pkgconfig folder)
for folder in a b; do
    mkdir -p $folder
    sed 's/PREFIX/'$folder'/' > $folder/c.pc << 'EOF'
prefix=/PREFIX
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib

Name: c
Description: c
Version: 1.0.0
Cflags: -I${includedir}
Libs: -L${libdir} -lc
Libs.private: -ld
EOF
done
export PKG_CONFIG_PATH="$PWD/a:$PWD/b"
  1. run pkgconf < 2.0.0
$ pkgconf --static --libs c
-L/a/lib -lc -ld
  1. run pkgconf >= 2.0.0
$ ./bui/pkgconf --static --libs c
-L/b/lib -lc -ld

Offending commit after bisecting seems to be 384ade5 and reverting that restores pre-2.0.0 behavior, however, I am not entirely sure the motivation behind that commit, so I can't tell if reverting will break something else.

I can't submit to https://gitea.treehouse.systems/ariadne/pkgconf right now, as it's giving me error 500.

Since the commit message mentions --with-path and the docs for that state "Adds a new module search path to pkgconf's dependency resolver. Paths added in this way are given preference before other paths." I'd guess that the changed behavior for other cases was an oversight.

I guess this issue breaks the pkgconf 2.0 update attempts in vcpkg (microsoft/vcpkg#33055, microsoft/vcpkg#33729, microsoft/vcpkg#34175):
Similar to PKG_CONFIG_PATH="$PWD/a:$PWD/b" above, I observe unexpected debug variant pc file results for "release:debug" style pkgconfig path order.

IIUC all list processing in pkgconf_path_split (pkgconf_path_build_from_environ) now results in reversed lists, doesn't it?

IIUC --with-path is applied early (before reading PKG_CONFIG_PATH) so it wouldn't need to insert. Insertion at begin is the wrong operation also when the option is given multiple times.
So just revert the change, and add a test?
https://github.com/pkgconf/pkgconf/compare/master...dg0yt:pkgconf:list-order?expand=1