Bug 169697 - syslogd(8) is not BOM aware
Summary: syslogd(8) is not BOM aware
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-07 16:00 UTC by c.kworr
Modified: 2018-05-20 23:53 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description c.kworr 2012-07-07 16:00:23 UTC
Sending a UTF-8 formatted string starting with BOM to syslogd via /dev/log almost works:

#!/usr/bin/evn python

from __future__ import unicode_literals

import logging, logging.handlers
logger = logging.getLogger('test')
handler = logging.handlers.SysLogHandler('/dev/log')
handler.setFormatter(logging.Formatter('%(name)s[%(process)s]: %(message)s'))
logger.addHandler(handler)
logger.critical('test')

This results in following line in log:

Jul  7 17:31:19 limbo test[9154]: test

But hexdump of it shows:

00000000  4a 75 6c 20 20 37 20 31  37 3a 32 37 3a 32 37 20  |Jul  7 17:27:27 |
00000010  6c 69 6d 62 6f 20 ef bb  bf 74 65 73 74 5b 35 36  |limbo ...test[56|
00000020  37 33 5d 3a 20 74 65 73  74 0a                    |73]: test.|
0000002a

Note the BOM before logger name. It account as part of name, and such messages can't be rerouted via /etc/syslogd.conf as they just doesn't match. Including BOM field into the logs is also not a good thing.

Fix: 

I think BOM can be safely dropped if:

 - line starts with BOM;
 - '-8' switch is given.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:53:03 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"