monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] basic_io not binary transparent?


From: Christof Petig
Subject: Re: [Monotone-devel] basic_io not binary transparent?
Date: Fri, 08 Dec 2006 23:24:05 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061115)

Nathaniel J. Smith schrieb:
> On Wed, Dec 06, 2006 at 06:31:32PM +0100, Christof Petig wrote:
>> Hi,
>>
>> within mtn_cvs I transfer binary (gzip'd) data between mtn and mtn_cvs
>> using basic_io. I found that NUL bytes terminate a lexical unit (if
>> that's the exact wording) and so the parser aborts with an error.
>>
>> Should I
>> - fix basic_io to work with NUL bytes, or
>> - escape NUL bytes (e.g. as \0 )
> 
> My gut reaction is that not allowing NUL bytes is a bug, and quite
> possibly a bug in Boost that we picked up accidentally or something.
> (Of course, they should only be allowed in ""-strings.)

Actually the NUL byte turned out to be not the real problem, the problem
was the 0xff byte following the NUL bytes which terminated the string.
(int(char(0xff))==EOF on intel machines)

Patch:
============================================================
--- basic_io.hh d8c0da1addf5ce3ebda40f4508db86375620343a
+++ basic_io.hh 2d6d4c0e33715ae8addbf0467dc535edbd88f683
@@ -78,7 +78,7 @@ namespace basic_io
     inline void peek()
     {
       if (LIKELY(curr != in.end()))
-       lookahead = *curr;
+       lookahead = *curr & 0xff;
       else
        lookahead = EOF;
     }

Ok to commit? (along with a unit test to check transparency in strings)
I have to prepare a branch with inclusion proposals from cvssync anyway.

   Christof

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]