Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jul 2012 14:50:33 GMT
From:      Volodymyr Kostyrko <c.kworr@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   standards/169697: syslogd(8) is not BOM aware
Message-ID:  <201207071450.q67EoX2H038199@red.freebsd.org>
Resent-Message-ID: <201207071500.q67F0Nnh004775@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         169697
>Category:       standards
>Synopsis:       syslogd(8) is not BOM aware
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 07 15:00:23 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Volodymyr Kostyrko
>Release:        RELENG_9
>Organization:
None
>Environment:
# uname -a
FreeBSD limbo.xim.bz 9.0-STABLE FreeBSD 9.0-STABLE #2 r238059M: Tue Jul  3 15:27:12 EEST 2012     arcade@limbo.xim.bz:/usr/obj/usr/src/sys/MINIMALx32  i386
>Description:
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.
>How-To-Repeat:

>Fix:
I think BOM can be safely dropped if:

 - line starts with BOM;
 - '-8' switch is given.

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207071450.q67EoX2H038199>