python-2.7.3:remove BOM insertion code

Backport patch from:
https://hg.python.org/cpython/rev/af46a001d5ec

SysLogHandler converts message to utf8 and adds BOM, supposedly
to conform with RFC5424, but the implementation is broken:
the RFC specifies that the BOM should prefix only unstructured
message part, but current Python implementation puts it in the
middle of structured part, thus confusing RFC-compliant receivers.

(From OE-Core rev: c51caffe5ac0d49844dcbac7967f609d44c20470)

Signed-off-by: yzhu1 <yanjun.zhu@windriver.com>
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kai Kang
2014-10-29 19:16:08 +08:00
committed by Richard Purdie
parent d6fd3030f9
commit 72964fca1d
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# HG changeset patch
# User Vinay Sajip <vinay_sajip@yahoo.co.uk>
# Date 1334583503 -3600
# Node ID af46a001d5eca99a7ff44ed18256c235c5c3f1d0
# Parent 33bc53e0aa9ea42c6a6bb077d182e62c8c569aa1
Issue #14452: remove BOM insertion code.
Backport from https://hg.python.org/cpython/rev/af46a001d5ec.
Upstream-Status: Backport
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -821,8 +821,6 @@ class SysLogHandler(logging.Handler):
# Message is a string. Convert to bytes as required by RFC 5424
if type(msg) is unicode:
msg = msg.encode('utf-8')
- if codecs:
- msg = codecs.BOM_UTF8 + msg
msg = prio + msg
try:
if self.unixsocket: