From 5807f1de04aa7d3910e7f694e0d1e5613d8f5b41 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 13 Jun 2008 13:05:44 -0400 Subject: [PATCH] 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. --- IkiWiki/Plugin/search.pm | 10 ++++++++-- debian/changelog | 3 +++ ..._rebuild_wiki_pages_with_ikiwiki_2.49.mdwn | 10 ++++++++++ ikiwiki-mass-rebuild | 19 ++++++++++++++++++- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 3ac435197..8fc2f3724 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -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"); } } diff --git a/debian/changelog b/debian/changelog index 579e5f6c3..d1a3d0b3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sat, 07 Jun 2008 23:04:00 -0400 diff --git a/doc/bugs/Can__39__t_rebuild_wiki_pages_with_ikiwiki_2.49.mdwn b/doc/bugs/Can__39__t_rebuild_wiki_pages_with_ikiwiki_2.49.mdwn index b59984e3e..6e43c1149 100644 --- a/doc/bugs/Can__39__t_rebuild_wiki_pages_with_ikiwiki_2.49.mdwn +++ b/doc/bugs/Can__39__t_rebuild_wiki_pages_with_ikiwiki_2.49.mdwn @@ -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]] diff --git a/ikiwiki-mass-rebuild b/ikiwiki-mass-rebuild index 3d0ca734c..f13033e7f 100755 --- a/ikiwiki-mass-rebuild +++ b/ikiwiki-mass-rebuild @@ -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; -- 2.39.5