fix two build bugs

* ikiwiki-mass-rebuild: Make group list comparison more robust.
* search: Work around xapian bug #486138 by only stemming locales
  in a whitelist.
master
Joey Hess 2008-06-13 13:05:44 -04:00
parent 340f219818
commit 5807f1de04
4 changed files with 39 additions and 3 deletions

View File

@ -108,8 +108,14 @@ sub index (@) { #{{{
if (! $stemmer) {
my $langcode=$ENV{LANG} || "en";
$langcode=~s/_.*//;
eval { $stemmer=Search::Xapian::Stem->new($langcode) };
if ($@) {
# This whitelist is here to work around a xapian bug (#486138)
my @whitelist=qw{da de en es fi fr hu it no pt ru ro sv tr};
if (grep { $_ eq $langcode } @whitelist) {
$stemmer=Search::Xapian::Stem->new($langcode);
}
else {
$stemmer=Search::Xapian::Stem->new("english");
}
}

3
debian/changelog vendored
View File

@ -3,6 +3,9 @@ ikiwiki (2.50) UNRELEASED; urgency=low
* img: Support captions.
* img: Don't generate empty title attributes, etc.
* img: Allow setting defaults for class and id too.
* ikiwiki-mass-rebuild: Make group list comparison more robust.
* search: Work around xapian bug #486138 by only stemming locales
in a whitelist.
-- Joey Hess <joeyh@debian.org> Sat, 07 Jun 2008 23:04:00 -0400

View File

@ -16,3 +16,13 @@ I've installed all needed packages for new search engine and added path
to `omega` binary in my `ikiwiki.setup` file.
Any ideas how to fix that problem? --[[Paweł|ptecza]]
> Well, it's two separate problems. Xapian is crashing in the C code when
> asked to create a stemmer for `pl`. This is a Xapain bug, but I've put
> in a workaround.
>
> For the first problem, looks like I need a more robust grouplist comparor
> -- fixed in git.
>
> [[done]]
> --[[Joey]]

View File

@ -15,6 +15,23 @@ sub supplemental_groups {
return @list;
}
sub samelists {
my %a=map { $_ => 1 } split(' ', shift());
my %b=map { $_ => 1 } split(' ', shift());
foreach my $i (keys %b) {
if (! exists $a{$i}) {
return 0;
}
}
foreach my $i (keys %a) {
if (! exists $b{$i}) {
return 0;
}
}
return 1;
}
sub processline {
my $user=shift;
my $setup=shift;
@ -34,7 +51,7 @@ sub processline {
if (! $pid) {
my ($uuid, $ugid) = (getpwnam($user))[2, 3];
my $grouplist=join(" ", $ugid, sort {$a <=> $b} $ugid, supplemental_groups($user));
if (($)=$grouplist) ne $grouplist) {
if (! samelists(($)=$grouplist), $grouplist)) {
die "failed to set egid $grouplist (got back $))";
}
$(=$ugid;