Package: pkgconf
Severity: serious

When a pkg doesn't have its dependencies satisfied, pkgconf --cflags
etc all print an error message and return a failure exit code.

With pkg-config, --exists does this check too, exits with an error and
with --print-errors present, prints the same error as --cflags etc do.

With pkgconf, --exists exits with an error only when the .pc file
doesn't actually exist, so I think it doesn't check if dependencies
are satisfied either, since with --print-errors no errors are printed.

This breaks the adequate test missing-pkgconfig-dependency, which runs
pkg-config and parses the output for errors about missing dependencies,
see below for the code that does this parsing.

   pkg-config --exists --print-errors foo

An example of the behaviour under pkg-config:

   $ pkg-config --exists --print-errors mpv ; echo $?
   Package wayland-protocols was not found in the pkg-config search path.
   Perhaps you should add the directory containing `wayland-protocols.pc'
   to the PKG_CONFIG_PATH environment variable
   Package 'wayland-protocols', required by 'mpv', not found
   1
   
An example of the behaviour under pkgconf:

   $ pkgconf --exists --print-errors mpv ; echo $?
   0

   $ pkgconf --cflags mpv ; echo $?
   Package wayland-protocols was not found in the pkg-config search path.
   Perhaps you should add the directory containing `wayland-protocols.pc'
   to the PKG_CONFIG_PATH environment variable
   Package 'wayland-protocols', required by 'mpv', not found
   
   1

This is the bug that lead me to this pkgconf bug:

   https://bugs.debian.org/1026624

Here is the code from adequate that performs this check,
please ensure that the error message matches the regex below.

   $ dgrep -EC4 pkg-?conf adequate
   /usr/bin/adequate-    check_elfs(%file_map);
   /usr/bin/adequate-    check_paths(%file_map);
   /usr/bin/adequate-    check_alternatives(\%package_map, \%file_map);
   /usr/bin/adequate-    check_binfmts(@packages);
   /usr/bin/adequate:    check_pkgconfig(%file_map);
   /usr/bin/adequate-    flush_debconf();
   /usr/bin/adequate-    return;
   /usr/bin/adequate-}
   /usr/bin/adequate-
   --
   /usr/bin/adequate-    }
   /usr/bin/adequate-    return;
   /usr/bin/adequate-}
   /usr/bin/adequate-
   /usr/bin/adequate:sub check_pkgconfig
   /usr/bin/adequate:: Tags(qw(missing-pkgconfig-dependency))
   /usr/bin/adequate-{
   /usr/bin/adequate-    my %file_map = @_;
   /usr/bin/adequate-    my %pkg_map = ();
   /usr/bin/adequate:    -x '/usr/bin/pkg-config' or return;
   /usr/bin/adequate-    while (my ($debpkg, $files) = each %file_map) {
   /usr/bin/adequate-        for my $file (@{$files}) {
   /usr/bin/adequate:            $file =~ 
m{^/usr/(?:share|lib(?:/[^/]+)?)/pkgconfig/([^/]+)[.]pc$} or next;
   /usr/bin/adequate-            my $pkg = $1;
   /usr/bin/adequate-            $pkg_map{$pkg} = $debpkg;
   /usr/bin/adequate-        }
   /usr/bin/adequate-    }
   /usr/bin/adequate-    while (my ($pkg, $debpkg) = each %pkg_map) {
   /usr/bin/adequate-        local $ENV{LC_ALL} = 'C';
   /usr/bin/adequate-        flush_std_fh();
   /usr/bin/adequate:        my $pkgconfig_pid = open(my $pkgconfig, '-|') // 
die "can't fork: $ERRNO";
   /usr/bin/adequate:        if ($pkgconfig_pid) { # parent
   /usr/bin/adequate:            while (<$pkgconfig>) {
   /usr/bin/adequate-                if (m/^Package '(.+)', required by 
'\Q$pkg\E', not found$/) {
   /usr/bin/adequate-                    my $deppkg = $1;
   /usr/bin/adequate:                    tag $debpkg, 
'missing-pkgconfig-dependency', $pkg, '=>', $deppkg;
   /usr/bin/adequate-                }
   /usr/bin/adequate-            }
   /usr/bin/adequate:            wait or die "pkg-config --exists: $ERRNO";
   /usr/bin/adequate:            close $pkgconfig;  ## no critic 
(CheckedSyscalls)
   /usr/bin/adequate-        } else { # child
   /usr/bin/adequate-            open(STDERR, '>&STDOUT') or die "can't 
redirect stderr: $ERRNO";
   /usr/bin/adequate:            exec('pkg-config', '--exists', 
'--print-errors', $pkg);
   /usr/bin/adequate:            die "can't exec pkg-config: $ERRNO";
   /usr/bin/adequate-        }
   /usr/bin/adequate-    }
   /usr/bin/adequate-    return;
   /usr/bin/adequate-}

-- System Information:
Debian Release: bookworm/sid
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 
'unstable-debug'), (800, 'unstable'), (790, 'buildd-unstable'), (700, 
'experimental-debug'), (700, 'experimental'), (690, 'buildd-experimental')
merged-usr: no
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-6-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8), LANGUAGE=en_AU:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pkgconf depends on:
ii  pkgconf-bin  1.8.0-11

pkgconf recommends no packages.

pkgconf suggests no packages.

-- no debconf information

-- 
bye,
pabs

https://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to