Merge remote-tracking branch 'remotes/smcv/ready/careful-eval'

master
Joey Hess 2014-02-23 14:21:13 -04:00
commit ddc9441beb
8 changed files with 26 additions and 10 deletions

View File

@ -351,7 +351,8 @@ sub cgi_getsession ($) {
{ FileName => "$config{wikistatedir}/sessions.db" })
};
if (! $session || $@) {
error($@." ".CGI::Session->errstr());
my $error = $@;
error($error." ".CGI::Session->errstr());
}
umask($oldmask);

View File

@ -553,7 +553,9 @@ sub aggregate (@) {
};
}
if ($@) {
$feed->{message}=gettext("feed crashed XML::Feed!")." ($@)";
# gettext can clobber $@
my $error = $@;
$feed->{message}=gettext("feed crashed XML::Feed!")." ($error)";
$feed->{error}=1;
debug($feed->{message});
next;
@ -675,7 +677,9 @@ sub write_page ($$$$$) {
$template=template($feed->{template}, blind_cache => 1);
};
if ($@) {
print STDERR gettext("failed to process template:")." $@";
# gettext can clobber $@
my $error = $@;
print STDERR gettext("failed to process template:")." $error";
return;
}
$template->param(title => $params{title})

View File

@ -229,8 +229,10 @@ sub attachment_store {
check_canattach($session, $final_filename, $tempfile);
};
if ($@) {
json_response($q, $form, $dest."/".$filename, $@);
error $@;
# save error in case called functions clobber $@
my $error = $@;
json_response($q, $form, $dest."/".$filename, $error);
error $error;
}
# Move the attachment into holding directory.

View File

@ -400,10 +400,12 @@ sub cgi_editpage ($$) {
eval { writefile($file, $config{srcdir}, $content) };
$config{cgi}=1;
if ($@) {
# save $@ in case a called function clobbers it
my $error = $@;
$form->field(name => "rcsinfo", value => rcs_prepedit($file),
force => 1);
my $mtemplate=template("editfailedsave.tmpl");
$mtemplate->param(error_message => $@);
$mtemplate->param(error_message => $error);
$form->tmpl_param("message", $mtemplate->output);
$form->field("editcontent", value => $content, force => 1);
$form->tmpl_param("page_select", 0);

View File

@ -130,9 +130,11 @@ sub filltemplate ($$) {
$template=template("/".$template_page);
};
if ($@) {
# gettext can clobber $@
my $error = $@;
# Indicate that the earlier preprocessor directive set
# up a template that doesn't work.
return "[[!edittemplate ".gettext("failed to process template:")." $@]]";
return "[[!edittemplate ".gettext("failed to process template:")." $error]]";
}
$template->param(name => $page);

View File

@ -391,7 +391,9 @@ sub preprocess_inline (@) {
blind_cache => 1);
};
if ($@) {
error sprintf(gettext("failed to process template %s"), $params{template}.".tmpl").": $@";
# gettext can clobber $@
my $error = $@;
error sprintf(gettext("failed to process template %s"), $params{template}.".tmpl").": $error";
}
}
my $needcontent=$raw || (!($archive && $quick) && $template->query(name => 'content'));

View File

@ -92,8 +92,9 @@ sub htmlize (@) {
$markdown_sub=\&Markdown::Markdown;
}
else {
my $error = $@;
do "/usr/bin/markdown" ||
error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $error, $!));
$markdown_sub=\&Markdown::Markdown;
}
}

View File

@ -41,9 +41,11 @@ sub preprocess (@) {
blind_cache => 1);
};
if ($@) {
# gettext can clobber $@
my $error = $@;
error sprintf(gettext("failed to process template %s"),
htmllink($params{page}, $params{destpage},
"/templates/$params{id}"))." $@";
"/templates/$params{id}"))." $error";
}
$params{basename}=IkiWiki::basename($params{page});