aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/syslog_fails_with_non-ASCII_wikinames.mdwn
blob: f2e3849f4c5a852f5d64e3642a59513c32f37a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[[!template  id=gitbranch branch=anarcat/syslog_utf8 author="[[anarcat]]"]]

[[this feature|todo/syslog_should_show_wiki_name]] made it so syslog doesn't work anymore if the site being logged has non-ASCII characters it in.

Specifically, my wiki was named "CⒶTS", and nothing was showing up in syslog. When I changed that to "C@TS", it worked again.

My guess is this sits somewhere here:

[[!format perl """
		return eval {
			Sys::Syslog::syslog($type, "[$config{wikiname}] %s", join(" ", @_));
		};
"""]]

Yet I am not sure how to fix that kind of problem in Perl... --[[anarcat]]

I tried to make this unit test:

[[!format perl """
#!/usr/bin/perl
use warnings;
use strict;
use Test::More tests => 5;

BEGIN { use_ok("IkiWiki"); }

$IkiWiki::config{verbose} = 1;
$IkiWiki::config{syslog} = 1;
$IkiWiki::config{wikiname} = 'ascii';
ok(debug('test'));
$IkiWiki::config{wikiname} = 'not ⒶSCII';
ok(debug('test'));
"""]]

And I couldn't reproduce the problem. Therefore, I suspect the problem may be somewhere else - maybe in the options parsing? One thing that's for sure: when I put that funky character in the title, it breaks logging! If I remove the "eval" above, I get:

    Error: Wide character in syswrite at /usr/lib/perl/5.14/Sys/Syslog.pm line 485.

I have improved a little the error handling in log_message() so that we see *something* when syslog fails, see the branch documented above. I can also confirm that reverting [[todo/syslog_should_show_wiki_name]] fixes the bug.