* Make sure to check for errors from every eval.
parent
dd2ce6e6a0
commit
35ee7e44a6
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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});
|
||||
} #}}}
|
||||
|
|
|
@ -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});
|
||||
} #}}}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 |");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -213,6 +213,7 @@ sub refresh () { #{{{
|
|||
my %exists;
|
||||
my @files;
|
||||
eval q{use File::Find};
|
||||
error($@) if $@;
|
||||
find({
|
||||
no_chdir => 1,
|
||||
wanted => sub {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue