Don't fail to syslog if the wiki name contains %s
This is a corner case spotted while fixing UTF-8 syslogging.master
parent
b8dbb48fdc
commit
02a1aa4e49
|
@ -843,12 +843,9 @@ sub log_message ($$) {
|
||||||
$log_open=1;
|
$log_open=1;
|
||||||
}
|
}
|
||||||
eval {
|
eval {
|
||||||
# keep a copy to avoid editing the original config repeatedly
|
my $message = "[$config{wikiname}] ".join(" ", @_);
|
||||||
my $wikiname = $config{wikiname};
|
|
||||||
utf8::encode($wikiname);
|
|
||||||
my $message = join(" ", @_);
|
|
||||||
utf8::encode($message);
|
utf8::encode($message);
|
||||||
Sys::Syslog::syslog($type, "[$wikiname] %s", $message);
|
Sys::Syslog::syslog($type, "%s", $message);
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
print STDERR "failed to syslog: $@" unless $log_failed;
|
print STDERR "failed to syslog: $@" unless $log_failed;
|
||||||
|
|
|
@ -11,7 +11,7 @@ $IkiWiki::config{syslog} = 1;
|
||||||
|
|
||||||
$IkiWiki::config{wikiname} = 'ASCII';
|
$IkiWiki::config{wikiname} = 'ASCII';
|
||||||
is(debug('test'), '', 'plain ASCII syslog');
|
is(debug('test'), '', 'plain ASCII syslog');
|
||||||
$IkiWiki::config{wikiname} = 'not ⒶSCII';
|
$IkiWiki::config{wikiname} = 'not ⒶSCII and has %s in it';
|
||||||
is(debug('𝗧ĕṡҭ'), '', 'UTF8 syslog');
|
is(debug('𝗧ĕṡҭ'), '', 'UTF8 syslog');
|
||||||
my $orig = $IkiWiki::config{wikiname};
|
my $orig = $IkiWiki::config{wikiname};
|
||||||
is(debug('test'), '', 'check for idempotency');
|
is(debug('test'), '', 'check for idempotency');
|
||||||
|
|
Loading…
Reference in New Issue