mirror of https://github.com/openssl/openssl.git
die() in .tmpl file should not be silently ignored.
call to die() in perl templates is currently ignored.
any error printed by die() commad appears in template
output.
In order to make sure die() terminates processing we
must ensure we emite `undef` value. This is ensured
by adding a `BROKEN` callback to `fill_in()` Template
method. The callback must return undef to stop processing.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26064)
(cherry picked from commit 578760bb6a
)
This commit is contained in:
parent
22ab18fa4f
commit
7de1da22ab
|
@ -145,7 +145,7 @@ _____
|
||||||
# defined in one template stick around for the
|
# defined in one template stick around for the
|
||||||
# next, making them combinable
|
# next, making them combinable
|
||||||
PACKAGE => 'OpenSSL::safe')
|
PACKAGE => 'OpenSSL::safe')
|
||||||
or die $Text::Template::ERROR;
|
or die $OpenSSL::Template::ERROR;
|
||||||
close BUILDFILE;
|
close BUILDFILE;
|
||||||
rename("$buildfile.new", $buildfile)
|
rename("$buildfile.new", $buildfile)
|
||||||
or die "Trying to rename $buildfile.new to $buildfile: $!";
|
or die "Trying to rename $buildfile.new to $buildfile: $!";
|
||||||
|
@ -167,7 +167,7 @@ _____
|
||||||
# defined in one template stick around for the
|
# defined in one template stick around for the
|
||||||
# next, making them combinable
|
# next, making them combinable
|
||||||
PACKAGE => 'OpenSSL::safe')
|
PACKAGE => 'OpenSSL::safe')
|
||||||
or die $Text::Template::ERROR;
|
or die $OpenSSL::Template::ERROR;
|
||||||
close CONFIGURATION_H;
|
close CONFIGURATION_H;
|
||||||
|
|
||||||
# When using stat() on Windows, we can get it to perform better by
|
# When using stat() on Windows, we can get it to perform better by
|
||||||
|
|
|
@ -42,6 +42,14 @@ use Text::Template 1.46;
|
||||||
|
|
||||||
our @ISA = qw(Text::Template); # parent
|
our @ISA = qw(Text::Template); # parent
|
||||||
|
|
||||||
|
sub tmpl_error {
|
||||||
|
my (%err_dict) = @_;
|
||||||
|
|
||||||
|
$ERROR = $err_dict{"error"};
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
|
|
||||||
|
@ -66,6 +74,7 @@ sub fill_in {
|
||||||
output_on => sub { $self->output_on() },
|
output_on => sub { $self->output_on() },
|
||||||
output_off => sub { $self->output_off() },
|
output_off => sub { $self->output_off() },
|
||||||
%hash },
|
%hash },
|
||||||
|
BROKEN => \&tmpl_error,
|
||||||
%opts);
|
%opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue