Skip to content

Commit

Permalink
Double bug fix:
Browse files Browse the repository at this point in the history
- filter out pkglocate output to actually get paths, just because the
search terms may also be pkgpaths.
- fix the request to get what it should: the db has been canonicalized,
and we *must* use the canonical field in _paths to get to the right location.
  • Loading branch information
Marc Espie committed Jan 20, 2020
1 parent e08f4e6 commit becbb0c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/SqlPorts.pm
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,10 @@ sub search
my %h;
if (open(my $fh, "-|", config->{pkglocate}, $search->{file})) {
while (<$fh>) {
if (m/^.*?\:(.*?)\:/) {
$h{$1} = 1;
}
next unless m/^.*?\:(.*?)\:(.*)/;
my ($pkgpath, $filepath) = ($1, $2);
next unless $filepath =~ m/\Q$search->{file}\E/;
$h{$pkgpath} = 1;
}
close $fh;
push(@where, "_paths.fullpkgpath in (".join(', ', map {$db->quote($_)} keys %h).")");
Expand Down Expand Up @@ -346,7 +347,7 @@ sub search
$s = qq{select
_paths.fullpkgpath, fullpkgname
from _paths
join _Ports on _paths.id=_Ports.fullpkgpath
join _Ports on _paths.canonical=_Ports.fullpkgpath
$s
order by fullpkgname
};
Expand Down

0 comments on commit becbb0c

Please sign in to comment.