]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Make sure to check for errors from every eval.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 8 Nov 2006 21:03:33 +0000 (21:03 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 8 Nov 2006 21:03:33 +0000 (21:03 +0000)
14 files changed:
IkiWiki.pm
IkiWiki/CGI.pm
IkiWiki/Plugin/aggregate.pm
IkiWiki/Plugin/htmlscrubber.pm
IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/search.pm
IkiWiki/Plugin/tag.pm
IkiWiki/Rcs/git.pm
IkiWiki/Rcs/mercurial.pm
IkiWiki/Rcs/svn.pm
IkiWiki/Rcs/tla.pm
IkiWiki/Render.pm
debian/changelog
doc/bugs/bestlink_change_update_issue.mdwn

index 73bc747f9b443c6aee916b057b3f21c9d61c3c66..efacb20ed309e65859ea2ac26cac51443dc31ce1 100644 (file)
@@ -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(
index f76019d0e5fabebf2ee63e4d1796174c028ee66e..6b5a1e1307e03d0c9fe87829d849f0111679cfa6 100644 (file)
@@ -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;
        
index 8c4b1bfe930c6bdc133160cf9a24483f490a64d5..2a3f36fcebd07be205075b81e57c49737ce35d74 100644 (file)
@@ -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};
index 3035307c246001acefd8e3bd945a6f3b8280520b..ae3ec44569d3e666ca5abe60f9afc19e5b6643c6 100644 (file)
@@ -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{
index ad8b718f3d6062355c9189ff66862facdafd6bd0..c6c6c6a1e286bdacb46378d0767f5fa566c4c522 100644 (file)
@@ -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));
index a57a8404819b07f8449b634e0de32772a8c76ff8..3cfc301e2e7815c4ff36f181fa38d01f319afb58 100644 (file)
@@ -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});
 } #}}}
index 6d22c49fd441183f420878884b072c686d5d1dc3..ddb67c2a8b5ad52f24c76cd1ff512c27466232e4 100644 (file)
@@ -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});
 } #}}}
index 09275fe5f550868fac8c692665b63ce299bf2073..c8b5adc45d6b584064d93a06102b1ad0887ab01c 100644 (file)
@@ -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,
index 82a2fa642646cec3c54ad3be639babeb908ce4fe..36972c560e3c6b6f5426610bb0209bce99b86b5f 100644 (file)
@@ -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 |");
index f3e353cbe68b9d74af6c2798f7efd2ec43144117..2d3ad046caf95c171bbc0d1d2b56b0eeee738b42 100644 (file)
@@ -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;
index c9b64dbe5e09f4556126b5f1026c75a53fe22dc3..c71c9e6ee77907ea02afcc66e7e512323d50ce74 100644 (file)
@@ -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);
index 5b951df83255e40051f9bcc2f2e48ec2e05dc87d..47fbe7a61083eba6cb0f0bd08efe8623ddb0745a 100644 (file)
@@ -213,6 +213,7 @@ sub refresh () { #{{{
        my %exists;
        my @files;
        eval q{use File::Find};
+       error($@) if $@;
        find({
                no_chdir => 1,
                wanted => sub {
index 122ea596bc27959b809d43b6205f42caae1bd49a..d4a3a9c6fc8bd1da516214fc9c72e413ce9437ca 100644 (file)
@@ -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
 
index f8f132327b0b2077744e7aa4e1df00ce3e4efec4..67303159be632d4e91bcf28a96f44506d47f964d 100644 (file)
@@ -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.