#1041941 $ARCH-pkg-config reads a file ./$ARCH

Package:
pkgconf
Source:
pkgconf
Description:
manage compile and link flags for libraries
Submitter:
Enrico Zini
Date:
2023-07-25 10:30:04 UTC
Severity:
normal
#1041941#5
Date:
2023-07-25 10:27:49 UTC
From:
To:
Hello,

this was surprising behaviour for which I cannot find documentation,
which I discovered by accident by having a $ARCH file in my build
directory:

If invoking as pkg-config, everything is fine:

  $ rm x86_64-linux-gnu
  $ pkg-config --cflags libxml-2.0
  -I/usr/include/libxml2
  $ echo foo > x86_64-linux-gnu
  $ pkg-config --cflags libxml-2.0
  -I/usr/include/libxml2

If invoking as /usr/bin/x86_64-linux-gnu-pkg-config instead, a file with
called x86_64-linux-gnu gets parsed and influences the results:

  $ rm x86_64-linux-gnu
  $ /usr/bin/x86_64-linux-gnu-pkg-config --cflags libxml-2.0
  -I/usr/include/libxml2
  $ echo foo > x86_64-linux-gnu
  $ /usr/bin/x86_64-linux-gnu-pkg-config --cflags libxml-2.0
  Package libxml-2.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libxml-2.0.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'libxml-2.0', required by 'virtual:world', not found

It may be expected behaviour, or it may be something unintended that
leads to unexpected code execution. I cannot find it documented in man
pkg-config(1) or man pc(5) and I cannot tell what it's supposed to do,
so I'll limit myself to reporting the surprising behaviour.

It was pretty tricky to debug why this source which included such a file
used to build before bookworm and in bookworm stopped being unable to
find its dependencies


Thanks,

Enrico