* Make sure to check for errors from every eval.
parent
dd2ce6e6a0
commit
35ee7e44a6
|
@ -76,12 +76,14 @@ sub checkconfig () { #{{{
|
||||||
}
|
}
|
||||||
if (defined $config{locale}) {
|
if (defined $config{locale}) {
|
||||||
eval q{use POSIX};
|
eval q{use POSIX};
|
||||||
|
error($@) if $@;
|
||||||
$ENV{LANG} = $config{locale}
|
$ENV{LANG} = $config{locale}
|
||||||
if POSIX::setlocale(&POSIX::LC_TIME, $config{locale});
|
if POSIX::setlocale(&POSIX::LC_TIME, $config{locale});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config{w3mmode}) {
|
if ($config{w3mmode}) {
|
||||||
eval q{use Cwd q{abs_path}};
|
eval q{use Cwd q{abs_path}};
|
||||||
|
error($@) if $@;
|
||||||
$config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
|
$config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
|
||||||
$config{destdir}=possibly_foolish_untaint(abs_path($config{destdir}));
|
$config{destdir}=possibly_foolish_untaint(abs_path($config{destdir}));
|
||||||
$config{cgiurl}="file:///\$LIB/ikiwiki-w3m.cgi/".$config{cgiurl}
|
$config{cgiurl}="file:///\$LIB/ikiwiki-w3m.cgi/".$config{cgiurl}
|
||||||
|
@ -360,6 +362,7 @@ sub displaytime ($) { #{{{
|
||||||
my $time=shift;
|
my $time=shift;
|
||||||
|
|
||||||
eval q{use POSIX};
|
eval q{use POSIX};
|
||||||
|
error($@) if $@;
|
||||||
# strftime doesn't know about encodings, so make sure
|
# strftime doesn't know about encodings, so make sure
|
||||||
# its output is properly treated as utf8
|
# its output is properly treated as utf8
|
||||||
return decode_utf8(POSIX::strftime(
|
return decode_utf8(POSIX::strftime(
|
||||||
|
|
|
@ -74,10 +74,13 @@ sub cgi_recentchanges ($) { #{{{
|
||||||
# during page builds as the return values may change, but they
|
# during page builds as the return values may change, but they
|
||||||
# won't here.)
|
# won't here.)
|
||||||
eval q{use Memoize};
|
eval q{use Memoize};
|
||||||
|
error($@) if $@;
|
||||||
memoize("htmllink");
|
memoize("htmllink");
|
||||||
|
|
||||||
eval q{use Time::Duration};
|
eval q{use Time::Duration};
|
||||||
|
error($@) if $@;
|
||||||
eval q{use CGI 'escapeHTML'};
|
eval q{use CGI 'escapeHTML'};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
my $changelog=[rcs_recentchanges(100)];
|
my $changelog=[rcs_recentchanges(100)];
|
||||||
foreach my $change (@$changelog) {
|
foreach my $change (@$changelog) {
|
||||||
|
@ -114,6 +117,7 @@ sub cgi_signin ($$) { #{{{
|
||||||
my $session=shift;
|
my $session=shift;
|
||||||
|
|
||||||
eval q{use CGI::FormBuilder};
|
eval q{use CGI::FormBuilder};
|
||||||
|
error($@) if $@;
|
||||||
my $form = CGI::FormBuilder->new(
|
my $form = CGI::FormBuilder->new(
|
||||||
title => "signin",
|
title => "signin",
|
||||||
fields => [qw(do title page subpage from name password)],
|
fields => [qw(do title page subpage from name password)],
|
||||||
|
@ -262,6 +266,7 @@ sub cgi_signin ($$) { #{{{
|
||||||
);
|
);
|
||||||
|
|
||||||
eval q{use Mail::Sendmail};
|
eval q{use Mail::Sendmail};
|
||||||
|
error($@) if $@;
|
||||||
sendmail(
|
sendmail(
|
||||||
To => userinfo_get($user_name, "email"),
|
To => userinfo_get($user_name, "email"),
|
||||||
From => "$config{wikiname} admin <$config{adminemail}>",
|
From => "$config{wikiname} admin <$config{adminemail}>",
|
||||||
|
@ -294,6 +299,7 @@ sub cgi_prefs ($$) { #{{{
|
||||||
my $session=shift;
|
my $session=shift;
|
||||||
|
|
||||||
eval q{use CGI::FormBuilder};
|
eval q{use CGI::FormBuilder};
|
||||||
|
error($@) if $@;
|
||||||
my $form = CGI::FormBuilder->new(
|
my $form = CGI::FormBuilder->new(
|
||||||
title => "preferences",
|
title => "preferences",
|
||||||
fields => [qw(do name password confirm_password email
|
fields => [qw(do name password confirm_password email
|
||||||
|
@ -388,6 +394,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
my @buttons=("Save Page", "Preview", "Cancel");
|
my @buttons=("Save Page", "Preview", "Cancel");
|
||||||
|
|
||||||
eval q{use CGI::FormBuilder; use CGI::FormBuilder::Template::HTML};
|
eval q{use CGI::FormBuilder; use CGI::FormBuilder::Template::HTML};
|
||||||
|
error($@) if $@;
|
||||||
my $renderer=CGI::FormBuilder::Template::HTML->new(
|
my $renderer=CGI::FormBuilder::Template::HTML->new(
|
||||||
fields => \@fields,
|
fields => \@fields,
|
||||||
template_params("editpage.tmpl"),
|
template_params("editpage.tmpl"),
|
||||||
|
@ -639,8 +646,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub cgi () { #{{{
|
sub cgi () { #{{{
|
||||||
eval q{use CGI};
|
eval q{use CGI; use CGI::Session};
|
||||||
eval q{use CGI::Session};
|
error($@) if $@;
|
||||||
|
|
||||||
my $q=CGI->new;
|
my $q=CGI->new;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ sub import { #{{{
|
||||||
|
|
||||||
sub getopt () { #{{{
|
sub getopt () { #{{{
|
||||||
eval q{use Getopt::Long};
|
eval q{use Getopt::Long};
|
||||||
|
error($@) if $@;
|
||||||
Getopt::Long::Configure('pass_through');
|
Getopt::Long::Configure('pass_through');
|
||||||
GetOptions("aggregate" => \$config{aggregate});
|
GetOptions("aggregate" => \$config{aggregate});
|
||||||
} #}}}
|
} #}}}
|
||||||
|
@ -150,7 +151,7 @@ sub loadstate () { #{{{
|
||||||
|
|
||||||
sub savestate () { #{{{
|
sub savestate () { #{{{
|
||||||
eval q{use HTML::Entities};
|
eval q{use HTML::Entities};
|
||||||
die $@ if $@;
|
error($@) if $@;
|
||||||
open (OUT, ">$config{wikistatedir}/aggregate" ||
|
open (OUT, ">$config{wikistatedir}/aggregate" ||
|
||||||
die "$config{wikistatedir}/aggregate: $!");
|
die "$config{wikistatedir}/aggregate: $!");
|
||||||
foreach my $data (values %feeds, values %guids) {
|
foreach my $data (values %feeds, values %guids) {
|
||||||
|
@ -219,9 +220,9 @@ sub expire () { #{{{
|
||||||
|
|
||||||
sub aggregate () { #{{{
|
sub aggregate () { #{{{
|
||||||
eval q{use XML::Feed};
|
eval q{use XML::Feed};
|
||||||
die $@ if $@;
|
error($@) if $@;
|
||||||
eval q{use HTML::Entities};
|
eval q{use HTML::Entities};
|
||||||
die $@ if $@;
|
error($@) if $@;
|
||||||
|
|
||||||
foreach my $feed (values %feeds) {
|
foreach my $feed (values %feeds) {
|
||||||
next unless $config{rebuild} ||
|
next unless $config{rebuild} ||
|
||||||
|
@ -316,6 +317,7 @@ sub add_page (@) { #{{{
|
||||||
# to avoid unneccessary rebuilding. The mtime from rss cannot be
|
# to avoid unneccessary rebuilding. The mtime from rss cannot be
|
||||||
# trusted; let's use a digest.
|
# trusted; let's use a digest.
|
||||||
eval q{use Digest::MD5 'md5_hex'};
|
eval q{use Digest::MD5 'md5_hex'};
|
||||||
|
error($@) if $@;
|
||||||
require Encode;
|
require Encode;
|
||||||
my $digest=md5_hex(Encode::encode_utf8($params{content}));
|
my $digest=md5_hex(Encode::encode_utf8($params{content}));
|
||||||
return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $config{rebuild};
|
return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $config{rebuild};
|
||||||
|
|
|
@ -19,6 +19,7 @@ sub scrubber { #{{{
|
||||||
return $_scrubber if defined $_scrubber;
|
return $_scrubber if defined $_scrubber;
|
||||||
|
|
||||||
eval q{use HTML::Scrubber};
|
eval q{use HTML::Scrubber};
|
||||||
|
error($@) if $@;
|
||||||
# Lists based on http://feedparser.org/docs/html-sanitization.html
|
# Lists based on http://feedparser.org/docs/html-sanitization.html
|
||||||
$_scrubber = HTML::Scrubber->new(
|
$_scrubber = HTML::Scrubber->new(
|
||||||
allow => [qw{
|
allow => [qw{
|
||||||
|
|
|
@ -211,6 +211,7 @@ sub date_822 ($) { #{{{
|
||||||
my $time=shift;
|
my $time=shift;
|
||||||
|
|
||||||
eval q{use POSIX};
|
eval q{use POSIX};
|
||||||
|
error($@) if $@;
|
||||||
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
|
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
|
||||||
POSIX::setlocale(&POSIX::LC_TIME, "C");
|
POSIX::setlocale(&POSIX::LC_TIME, "C");
|
||||||
my $ret=POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time));
|
my $ret=POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time));
|
||||||
|
@ -222,6 +223,7 @@ sub date_3339 ($) { #{{{
|
||||||
my $time=shift;
|
my $time=shift;
|
||||||
|
|
||||||
eval q{use POSIX};
|
eval q{use POSIX};
|
||||||
|
error($@) if $@;
|
||||||
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
|
my $lc_time= POSIX::setlocale(&POSIX::LC_TIME);
|
||||||
POSIX::setlocale(&POSIX::LC_TIME, "C");
|
POSIX::setlocale(&POSIX::LC_TIME, "C");
|
||||||
my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time));
|
my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time));
|
||||||
|
|
|
@ -23,6 +23,7 @@ sub import { #{{{
|
||||||
|
|
||||||
sub getopt () { #{{{
|
sub getopt () { #{{{
|
||||||
eval q{use Getopt::Long};
|
eval q{use Getopt::Long};
|
||||||
|
error($@) if $@;
|
||||||
Getopt::Long::Configure('pass_through');
|
Getopt::Long::Configure('pass_through');
|
||||||
GetOptions("estseek=s" => \$config{estseek});
|
GetOptions("estseek=s" => \$config{estseek});
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -16,6 +16,7 @@ sub import { #{{{
|
||||||
|
|
||||||
sub getopt () { #{{{
|
sub getopt () { #{{{
|
||||||
eval q{use Getopt::Long};
|
eval q{use Getopt::Long};
|
||||||
|
error($@) if $@;
|
||||||
Getopt::Long::Configure('pass_through');
|
Getopt::Long::Configure('pass_through');
|
||||||
GetOptions("tagbase=s" => \$config{tagbase});
|
GetOptions("tagbase=s" => \$config{tagbase});
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -344,6 +344,7 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
my ($num) = @_;
|
my ($num) = @_;
|
||||||
|
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
my ($sha1, $type, $when, $diffurl, $user, @pages, @message, @rets);
|
my ($sha1, $type, $when, $diffurl, $user, @pages, @message, @rets);
|
||||||
INFO: foreach my $ci (git_commit_info('HEAD', $num)) {
|
INFO: foreach my $ci (git_commit_info('HEAD', $num)) {
|
||||||
|
@ -458,6 +459,7 @@ sub rcs_notify () { #{{{
|
||||||
);
|
);
|
||||||
|
|
||||||
eval q{use Mail::Sendmail};
|
eval q{use Mail::Sendmail};
|
||||||
|
error($@) if $@;
|
||||||
foreach my $email (@email_recipients) {
|
foreach my $email (@email_recipients) {
|
||||||
sendmail(
|
sendmail(
|
||||||
To => $email,
|
To => $email,
|
||||||
|
|
|
@ -91,6 +91,7 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
my ($num) = @_;
|
my ($num) = @_;
|
||||||
|
|
||||||
eval q{use CGI 'escapeHTML'};
|
eval q{use CGI 'escapeHTML'};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
|
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
|
||||||
open (my $out, "@cmdline |");
|
open (my $out, "@cmdline |");
|
||||||
|
|
|
@ -122,10 +122,13 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
|
|
||||||
return unless -d "$config{srcdir}/.svn";
|
return unless -d "$config{srcdir}/.svn";
|
||||||
|
|
||||||
eval q{use Date::Parse};
|
eval q{
|
||||||
eval q{use Time::Duration};
|
use Date::Parse;
|
||||||
eval q{use XML::SAX};
|
use Time::Duration;
|
||||||
eval q{use XML::Simple};
|
use XML::SAX;
|
||||||
|
use XML::Simple;
|
||||||
|
};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
# avoid using XML::SAX::PurePerl, it's buggy with UTF-8 data
|
# avoid using XML::SAX::PurePerl, it's buggy with UTF-8 data
|
||||||
my @parsers = map { ${$_}{Name} } @{XML::SAX->parsers()};
|
my @parsers = map { ${$_}{Name} } @{XML::SAX->parsers()};
|
||||||
|
@ -241,6 +244,7 @@ sub rcs_notify () { #{{{
|
||||||
);
|
);
|
||||||
|
|
||||||
eval q{use Mail::Sendmail};
|
eval q{use Mail::Sendmail};
|
||||||
|
error($@) if $@;
|
||||||
foreach my $email (@email_recipients) {
|
foreach my $email (@email_recipients) {
|
||||||
sendmail(
|
sendmail(
|
||||||
To => $email,
|
To => $email,
|
||||||
|
@ -276,6 +280,7 @@ sub rcs_getctime ($) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
|
error($@) if $@;
|
||||||
$date=str2time($date);
|
$date=str2time($date);
|
||||||
debug("found ctime ".localtime($date)." for $file");
|
debug("found ctime ".localtime($date)." for $file");
|
||||||
return $date;
|
return $date;
|
||||||
|
|
|
@ -89,7 +89,9 @@ sub rcs_recentchanges ($) {
|
||||||
return unless -d "$config{srcdir}/{arch}";
|
return unless -d "$config{srcdir}/{arch}";
|
||||||
|
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
|
error($@) if $@;
|
||||||
eval q{use Mail::Header};
|
eval q{use Mail::Header};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
my $logs = `tla logs -d $config{srcdir}`;
|
my $logs = `tla logs -d $config{srcdir}`;
|
||||||
my @changesets = reverse split(/\n/, $logs);
|
my @changesets = reverse split(/\n/, $logs);
|
||||||
|
@ -159,6 +161,7 @@ sub rcs_notify () { #{{{
|
||||||
my $rev=int(possibly_foolish_untaint($ENV{REV}));
|
my $rev=int(possibly_foolish_untaint($ENV{REV}));
|
||||||
|
|
||||||
eval q{use Mail::Header};
|
eval q{use Mail::Header};
|
||||||
|
error($@) if $@;
|
||||||
open(LOG, $ENV{"ARCH_LOG"});
|
open(LOG, $ENV{"ARCH_LOG"});
|
||||||
my $head = Mail::Header->new(\*LOG);
|
my $head = Mail::Header->new(\*LOG);
|
||||||
close(LOG);
|
close(LOG);
|
||||||
|
@ -214,6 +217,7 @@ sub rcs_notify () { #{{{
|
||||||
);
|
);
|
||||||
|
|
||||||
eval q{use Mail::Sendmail};
|
eval q{use Mail::Sendmail};
|
||||||
|
error($@) if $@;
|
||||||
foreach my $email (@email_recipients) {
|
foreach my $email (@email_recipients) {
|
||||||
sendmail(
|
sendmail(
|
||||||
To => $email,
|
To => $email,
|
||||||
|
@ -228,7 +232,9 @@ sub rcs_notify () { #{{{
|
||||||
sub rcs_getctime ($) { #{{{
|
sub rcs_getctime ($) { #{{{
|
||||||
my $file=shift;
|
my $file=shift;
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
|
error($@) if $@;
|
||||||
eval q{use Mail::Header};
|
eval q{use Mail::Header};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
my $logs = `tla logs -d $config{srcdir}`;
|
my $logs = `tla logs -d $config{srcdir}`;
|
||||||
my @changesets = reverse split(/\n/, $logs);
|
my @changesets = reverse split(/\n/, $logs);
|
||||||
|
|
|
@ -213,6 +213,7 @@ sub refresh () { #{{{
|
||||||
my %exists;
|
my %exists;
|
||||||
my @files;
|
my @files;
|
||||||
eval q{use File::Find};
|
eval q{use File::Find};
|
||||||
|
error($@) if $@;
|
||||||
find({
|
find({
|
||||||
no_chdir => 1,
|
no_chdir => 1,
|
||||||
wanted => sub {
|
wanted => sub {
|
||||||
|
|
|
@ -6,8 +6,9 @@ ikiwiki (1.33) UNRELEASED; urgency=low
|
||||||
* Enable utf8 file IO in aggregate plugin.
|
* Enable utf8 file IO in aggregate plugin.
|
||||||
* Fix some issues with the new registration form.
|
* Fix some issues with the new registration form.
|
||||||
* Patch from Ethan Glasser Camp to add a skip option to the inline plugin.
|
* 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
|
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
|
* And if Foo/Bar/Baz is then removed, it forgets to update Foo/Bar to link
|
||||||
back to Foo/Baz.
|
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