Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'string.': 0.04; 'encoded': 0.05; 'msg': 0.07; 'utf-8': 0.07; 'bytes)': 0.09; 'instance.': 0.09; 'patches': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'referenced': 0.09; 'release.': 0.09; 'rfc': 0.09; 'subject:Why': 0.09; 'terry': 0.09; 'bug': 0.10; 'aug': 0.13; 'encoding': 0.15; '2.7.3': 0.16; 'april.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'roy': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'bytes': 0.17; 'jan': 0.18; 'versions': 0.20; 'earlier': 0.21; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'header:X-Complaints-To:1': 0.28; 'convert': 0.29; 'code': 0.31; 'running': 0.32; 'builds': 0.33; 'turns': 0.33; 'ubuntu': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'server': 0.35; 'adds': 0.35; 'machines': 0.35; 'sequence': 0.35; 'sometimes': 0.35; 'subject:?': 0.35; 'received:org': 0.36; 'really': 0.36; 'skip:u 20': 0.36; 'but': 0.36; 'anything': 0.36; 'possible': 0.37; 'two': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'release': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'remove': 0.61; 'day.': 0.63; 'different': 0.63; 'skip:n 10': 0.63; 'within': 0.64; 'great': 0.64; 'here': 0.65; 'our': 0.65; 'else.': 0.65; 'august': 0.66; 'smith': 0.71; '1st': 0.81; 'confusing': 0.84; 'packaged': 0.84; 'received:fios.verizon.net': 0.84; '24th': 0.91; 'skip:/ 30': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Why BOM in logging message? Date: Thu, 10 Jan 2013 18:45:15 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357861568 news.xs4all.nl 6953 [2001:888:2000:d::a6]:37205 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36595 On 1/10/2013 11:06 AM, Roy Smith wrote: > Well, this is fascinating. It turns out that while all of our > machines report that they're running 2.7.3, they have two different > versions of /usr/lib/python2.7/logging/handlers.py! > > -rw-r--r-- 1 root root 45076 Aug 1 05:39 /usr/lib/python2.7/logging/handlers.py > -rw-r--r-- 1 root root 45143 Apr 20 2012 /usr/lib/python2.7/logging/handlers.py > > The April 24th version has the BOM code in SysLogHander.emit(): The 'BOM' you are discussing here is not a true 2 or 4 byte byte-order-mark, but the pseudo-BOM (pseudo because a stream of single bytes has no byte order within the single bytes) that Micro$tupid adds (sometimes) to utf-8 encoded bytes to mark their encoding as utf-8 rather than anything else. In otherwords, it is a non-(anti-)standard U(nicode)E(ncoding)M(ark). It is actually the utf-8 encoding of the 2-byte BOM, and hence not a single mark! It is really confusing when people use 'BOM' to refer to a UEM sequence instead of a BOM. > | # 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 2.7.3 was released in April. > and the August 1st version doesn't: > > | # Message is a string. Convert to bytes as required by RFC 5424 > | if type(msg) is unicode: > | msg = msg.encode('utf-8') > | msg = prio + msg The issue referenced in an earlier messaged was to remove the UEM where it did not belong. > Is it possible there's two different 2.7.3 builds that somehow got > packaged by Ubuntu at different times? As you discovered, Ubuntu sometimes updates a release with bug patches before we release a new official bugfix release. 2.7.4, with many bugfixes, is still to see the light of day. > The pattern of which machines > have the August code and which have the April code correlates with > when we rolled out each server instance. Great detective work ;-). -- Terry Jan Reedy