From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 988041F8C6; Thu, 9 Sep 2021 20:45:41 +0000 (UTC) Date: Thu, 9 Sep 2021 20:45:41 +0000 From: Eric Wong To: Konstantin Ryabitsev Cc: meta@public-inbox.org Subject: [PATCH] gcf2: die if pkg-config is missing Message-ID: <20210909204541.GA11866@dcvr> References: <20210909182350.yzhdw3znylowb3im@meerkat.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210909182350.yzhdw3znylowb3im@meerkat.local> List-Id: Konstantin Ryabitsev wrote: > Hello: > > I can't seem to get a clean "make test" in the Debian container. It's possible > that I'm missing some of the packages, as the official Debian container image > is very minimal. Not sure, it's taking forever to update one of my VMs... > The dockerfile is here: https://gist.github.com/mricon/046ba7c8b03bd92176dbe83e04f2466c > > The pertinent section is: > RUN apt-get -y install git liburi-perl libemail-mime-perl libplack-perl libtimedate-perl \ > libdbd-sqlite3-perl libsearch-xapian-perl libnet-server-perl \ > libinline-c-perl libemail-address-xs-perl libparse-recdescent-perl \ > xapian-tools libencode-perl libdbi-perl liblinux-inotify2-perl \ > libio-compress-perl curl libmail-imapclient-perl sqlite3 \ > libgit2-dev make eatmydata Oops, pkg-config is needed for libgit2-dev. I thought most *-dev packages would pull it in... ------------8<------------ Subject: [PATCH] gcf2: die if pkg-config is missing We can't link properly to libgit2 without pkg-config telling us which libraries and headers to use. --- lib/PublicInbox/Gcf2.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm index 99f4ae04..0f967579 100644 --- a/lib/PublicInbox/Gcf2.pm +++ b/lib/PublicInbox/Gcf2.pm @@ -17,7 +17,8 @@ BEGIN { die 'PERL_INLINE_DIRECTORY not defined'; my $f = "$inline_dir/.public-inbox.lock"; open $lockfh, '>', $f or die "failed to open $f: $!\n"; - my $pc = which($ENV{PKG_CONFIG} // 'pkg-config'); + my $pc = which($ENV{PKG_CONFIG} // 'pkg-config') // + die "pkg-config missing for libgit2"; my ($dir) = (__FILE__ =~ m!\A(.+?)/[^/]+\z!); my $rdr = {}; open $rdr->{2}, '>', '/dev/null' or die "open /dev/null: $!"; > When I run "make test", I get the following failures: > > ... > t/gcf2.t ..................... Use of uninitialized value $file in index at /home/user/work/temp/pi/blib/lib/PublicInbox/Spawn.pm line 348. > Use of uninitialized value $file in concatenation (.) or string at /home/user/work/temp/pi/blib/lib/PublicInbox/Spawn.pm line 350. > Use of uninitialized value in subroutine entry at /home/user/work/temp/pi/blib/lib/PublicInbox/Spawn.pm line 388. > Use of uninitialized value in join or string at /home/user/work/temp/pi/blib/lib/PublicInbox/Spawn.pm line 389. Otherwise, maybe printing a stacktrace can shine a light on the problem: diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index fe7aa0a8..473d0716 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -343,8 +343,10 @@ unless ($set_nodatacow) { undef $set_nodatacow; undef $all_libc; +use Carp; sub which ($) { my ($file) = @_; + warn "file undefined ",Carp::longmess() unless defined($file); return $file if index($file, '/') >= 0; for my $p (split(/:/, $ENV{PATH})) { $p .= "/$file";