summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-08 21:03:33 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-08 21:03:33 +0000
commit35ee7e44a62f9126a83c1243b549d47cc5ca7b43 (patch)
treeba5c6a377f586a8c7114fb4387b2386f06f5e1ee
parentdd2ce6e6a064b804902369c74f8a654755ea3de2 (diff)
* Make sure to check for errors from every eval.
-rw-r--r--IkiWiki.pm3
-rw-r--r--IkiWiki/CGI.pm11
-rw-r--r--IkiWiki/Plugin/aggregate.pm8
-rw-r--r--IkiWiki/Plugin/htmlscrubber.pm1
-rw-r--r--IkiWiki/Plugin/inline.pm2
-rw-r--r--IkiWiki/Plugin/search.pm1
-rw-r--r--IkiWiki/Plugin/tag.pm1
-rw-r--r--IkiWiki/Rcs/git.pm2
-rw-r--r--IkiWiki/Rcs/mercurial.pm1
-rw-r--r--IkiWiki/Rcs/svn.pm13
-rw-r--r--IkiWiki/Rcs/tla.pm6
-rw-r--r--IkiWiki/Render.pm1
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/bestlink_change_update_issue.mdwn4
14 files changed, 46 insertions, 11 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 73bc747f9..efacb20ed 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -76,12 +76,14 @@ sub checkconfig () { #{{{
}
if (defined $config{locale}) {
eval q{use POSIX};
+ error($@) if $@;
$ENV{LANG} = $config{locale}
if POSIX::setlocale(&POSIX::LC_TIME, $config{locale});
}
if ($config{w3mmode}) {
eval q{use Cwd q{abs_path}};
+ error($@) if $@;
$config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
$config{destdir}=possibly_foolish_untaint(abs_path($config{destdir}));
$config{cgiurl}="file:///\$LIB/ikiwiki-w3m.cgi/".$config{cgiurl}
@@ -360,6 +362,7 @@ sub displaytime ($) { #{{{
my $time=shift;
eval q{use POSIX};
+ error($@) if $@;
# strftime doesn't know about encodings, so make sure
# its output is properly treated as utf8
return decode_utf8(POSIX::strftime(
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index f76019d0e..6b5a1e130 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -74,10 +74,13 @@ sub cgi_recentchanges ($) { #{{{
# during page builds as the return values may change, but they
# won't here.)
eval q{use Memoize};
+ error($@) if $@;
memoize("htmllink");
eval q{use Time::Duration};
+ error($@) if $@;
eval q{use CGI 'escapeHTML'};
+ error($@) if $@;
my $changelog=[rcs_recentchanges(100)];
foreach my $change (@$changelog) {
@@ -114,6 +117,7 @@ sub cgi_signin ($$) { #{{{
my $session=shift;
eval q{use CGI::FormBuilder};
+ error($@) if $@;
my $form = CGI::FormBuilder->new(
title => "signin",
fields => [qw(do title page subpage from name password)],
@@ -262,6 +266,7 @@ sub cgi_signin ($$) { #{{{
);
eval q{use Mail::Sendmail};
+ error($@) if $@;
sendmail(
To => userinfo_get($user_name, "email"),
From => "$config{wikiname} admin <$config{adminemail}>",
@@ -294,6 +299,7 @@ sub cgi_prefs ($$) { #{{{
my $session=shift;
eval q{use CGI::FormBuilder};
+ error($@) if $@;
my $form = CGI::FormBuilder->new(
title => "preferences",
fields => [qw(do name password confirm_password email
@@ -388,6 +394,7 @@ sub cgi_editpage ($$) { #{{{
my @buttons=("Save Page", "Preview", "Cancel");
eval q{use CGI::FormBuilder; use CGI::FormBuilder::Template::HTML};
+ error($@) if $@;
my $renderer=CGI::FormBuilder::Template::HTML->new(
fields => \@fields,
template_params("editpage.tmpl"),
@@ -639,8 +646,8 @@ sub cgi_editpage ($$) { #{{{
} #}}}
sub cgi () { #{{{
- eval q{use CGI};
- eval q{use CGI::Session};
+ eval q{use CGI; use CGI::Session};
+ error($@) if $@;
my $q=CGI->new;
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 8c4b1bfe9..2a3f36fce 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -25,6 +25,7 @@ sub import { #{{{
sub getopt () { #{{{
eval q{use Getopt::Long};
+ error($@) if $@;
Getopt::Long::Configure('pass_through');
GetOptions("aggregate" => \$config{aggregate});
} #}}}
@@ -150,7 +151,7 @@ sub loadstate () { #{{{
sub savestate () { #{{{
eval q{use HTML::Entities};
- die $@ if $@;
+ error($@) if $@;
open (OUT, ">$config{wikistatedir}/aggregate" ||
die "$config{wikistatedir}/aggregate: $!");
foreach my $data (values %feeds, values %guids) {
@@ -219,9 +220,9 @@ sub expire () { #{{{
sub aggregate () { #{{{
eval q{use XML::Feed};
- die $@ if $@;
+ error($@) if $@;
eval q{use HTML::Entities};
- die $@ if $@;
+ error($@) if $@;
foreach my $feed (values %feeds) {
next unless $config{rebuild} ||
@@ -316,6 +317,7 @@ sub add_page (@) { #{{{
# to avoid unneccessary rebuilding. The mtime from rss cannot be
# trusted; let's use a digest.
eval q{use Digest::MD5 'md5_hex'};
+ error($@) if $@;
require Encode;
my $digest=md5_hex(Encode::encode_utf8($params{content}));
return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $config{rebuild};
diff --git a/IkiWiki/Plugin/htmlscrubber.pm b/IkiWiki/Plugin/htmlscrubber.pm
index 3035307c2..ae3ec4456 100644
--- a/IkiWiki/Plugin/htmlscrubber.pm
+++ b/IkiWiki/Plugin/htmlscrubber.pm
@@ -19,6 +19,7 @@ sub scrubber { #{{{
return $_scrubber if defined $_scrubber;
eval q{use HTML::Scrubber};
+ error($@) if $@;
# Lists based on http://feedparser.org/docs/html-sanitization.html
$_scrubber = HTML::Scrubber->new(
allow => [qw{
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index ad8b718f3..c6c6c6a1e 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -211,6 +211,7 @@ sub date_822 ($) { #{{{
my $time=shift;
eval q{use POSIX};
+ error($@) if $@;
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
POSIX::setlocale(&POSIX::LC_TIME, "C");
my $ret=POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time));
@@ -222,6 +223,7 @@ sub date_3339 ($) { #{{{
my $time=shift;
eval q{use POSIX};
+ error($@) if $@;
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
POSIX::setlocale(&POSIX::LC_TIME, "C");
my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time));
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index a57a84048..3cfc301e2 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -23,6 +23,7 @@ sub import { #{{{
sub getopt () { #{{{
eval q{use Getopt::Long};
+ error($@) if $@;
Getopt::Long::Configure('pass_through');
GetOptions("estseek=s" => \$config{estseek});
} #}}}
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index 6d22c49fd..ddb67c2a8 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -16,6 +16,7 @@ sub import { #{{{
sub getopt () { #{{{
eval q{use Getopt::Long};
+ error($@) if $@;
Getopt::Long::Configure('pass_through');
GetOptions("tagbase=s" => \$config{tagbase});
} #}}}
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm
index 09275fe5f..c8b5adc45 100644
--- a/IkiWiki/Rcs/git.pm
+++ b/IkiWiki/Rcs/git.pm
@@ -344,6 +344,7 @@ sub rcs_recentchanges ($) { #{{{
my ($num) = @_;
eval q{use Date::Parse};
+ error($@) if $@;
my ($sha1, $type, $when, $diffurl, $user, @pages, @message, @rets);
INFO: foreach my $ci (git_commit_info('HEAD', $num)) {
@@ -458,6 +459,7 @@ sub rcs_notify () { #{{{
);
eval q{use Mail::Sendmail};
+ error($@) if $@;
foreach my $email (@email_recipients) {
sendmail(
To => $email,
diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm
index 82a2fa642..36972c560 100644
--- a/IkiWiki/Rcs/mercurial.pm
+++ b/IkiWiki/Rcs/mercurial.pm
@@ -91,6 +91,7 @@ sub rcs_recentchanges ($) { #{{{
my ($num) = @_;
eval q{use CGI 'escapeHTML'};
+ error($@) if $@;
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
open (my $out, "@cmdline |");
diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm
index f3e353cbe..2d3ad046c 100644
--- a/IkiWiki/Rcs/svn.pm
+++ b/IkiWiki/Rcs/svn.pm
@@ -122,10 +122,13 @@ sub rcs_recentchanges ($) { #{{{
return unless -d "$config{srcdir}/.svn";
- eval q{use Date::Parse};
- eval q{use Time::Duration};
- eval q{use XML::SAX};
- eval q{use XML::Simple};
+ eval q{
+ use Date::Parse;
+ use Time::Duration;
+ use XML::SAX;
+ use XML::Simple;
+ };
+ error($@) if $@;
# avoid using XML::SAX::PurePerl, it's buggy with UTF-8 data
my @parsers = map { ${$_}{Name} } @{XML::SAX->parsers()};
@@ -241,6 +244,7 @@ sub rcs_notify () { #{{{
);
eval q{use Mail::Sendmail};
+ error($@) if $@;
foreach my $email (@email_recipients) {
sendmail(
To => $email,
@@ -276,6 +280,7 @@ sub rcs_getctime ($) { #{{{
}
eval q{use Date::Parse};
+ error($@) if $@;
$date=str2time($date);
debug("found ctime ".localtime($date)." for $file");
return $date;
diff --git a/IkiWiki/Rcs/tla.pm b/IkiWiki/Rcs/tla.pm
index c9b64dbe5..c71c9e6ee 100644
--- a/IkiWiki/Rcs/tla.pm
+++ b/IkiWiki/Rcs/tla.pm
@@ -89,7 +89,9 @@ sub rcs_recentchanges ($) {
return unless -d "$config{srcdir}/{arch}";
eval q{use Date::Parse};
+ error($@) if $@;
eval q{use Mail::Header};
+ error($@) if $@;
my $logs = `tla logs -d $config{srcdir}`;
my @changesets = reverse split(/\n/, $logs);
@@ -159,6 +161,7 @@ sub rcs_notify () { #{{{
my $rev=int(possibly_foolish_untaint($ENV{REV}));
eval q{use Mail::Header};
+ error($@) if $@;
open(LOG, $ENV{"ARCH_LOG"});
my $head = Mail::Header->new(\*LOG);
close(LOG);
@@ -214,6 +217,7 @@ sub rcs_notify () { #{{{
);
eval q{use Mail::Sendmail};
+ error($@) if $@;
foreach my $email (@email_recipients) {
sendmail(
To => $email,
@@ -228,7 +232,9 @@ sub rcs_notify () { #{{{
sub rcs_getctime ($) { #{{{
my $file=shift;
eval q{use Date::Parse};
+ error($@) if $@;
eval q{use Mail::Header};
+ error($@) if $@;
my $logs = `tla logs -d $config{srcdir}`;
my @changesets = reverse split(/\n/, $logs);
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 5b951df83..47fbe7a61 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -213,6 +213,7 @@ sub refresh () { #{{{
my %exists;
my @files;
eval q{use File::Find};
+ error($@) if $@;
find({
no_chdir => 1,
wanted => sub {
diff --git a/debian/changelog b/debian/changelog
index 122ea596b..d4a3a9c6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,8 +6,9 @@ ikiwiki (1.33) UNRELEASED; urgency=low
* Enable utf8 file IO in aggregate plugin.
* Fix some issues with the new registration form.
* Patch from Ethan Glasser Camp to add a skip option to the inline plugin.
+ * Make sure to check for errors from every eval.
- -- Joey Hess <joeyh@debian.org> Wed, 8 Nov 2006 15:39:16 -0500
+ -- Joey Hess <joeyh@debian.org> Wed, 8 Nov 2006 15:57:35 -0500
ikiwiki (1.32) unstable; urgency=low
diff --git a/doc/bugs/bestlink_change_update_issue.mdwn b/doc/bugs/bestlink_change_update_issue.mdwn
index f8f132327..67303159b 100644
--- a/doc/bugs/bestlink_change_update_issue.mdwn
+++ b/doc/bugs/bestlink_change_update_issue.mdwn
@@ -6,4 +6,6 @@
* And if Foo/Bar/Baz is then removed, it forgets to update Foo/Bar to link
back to Foo/Baz.
- -- is this still true? (Yes (as of 1.0))
+As of 1.33, this is still true. The buggy code is the %linkchanged
+calculation in refresh(), which doesn't detect that the link has changed in
+this case.