monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] Re: Bug in CRLF conversions


From: Yury Polyanskiy
Subject: Re: [Monotone-devel] Re: Bug in CRLF conversions
Date: Sun, 29 Jan 2006 14:03:18 -0500

Richard and Bruce,

I'm sorry for confusion. I said from the very beginning that it is my
fault to use conversion for binary files. 

What I say is that if someone sets conversion (whatever he wants
charset, lineending) he can expect that *ANY* data will be converted
back to the same state before doing a diff, hash etc.

In other words I say: "Hey, monotone, please when checking out this file
do this conversion please. It's just pleasant for me to have it
converted in my working copy. But, monotone, be careful when writing
this file back into DB: I don't want anyone *EVER* to know about
whatever crazy conversions I ask you to do to *MY* copy".

I think anyone expects this kind of behavior. I set up conversion; it
beats the hell out of my binary but when I call "monotone commit"
monotone doesn't see any changes. Because *I* didn't change the file. I
only asked it to be converted (erroneusly).

The behavior is unexpected in two aspects (as I said before):
 1) split_lines(), join_lines() adds \n to the end of file if it lacked
one
 2) LF->CRLF translation is done in irreversible way: lone \r's are
replaced by \r\n and thus can not be repaired by "monotone commit".

Proposal: make line_end_convert() simply do a (just to illustrate idea,
using strcat is dumb of course):

   b = file;
   while(b && *b){
      e = strstr(b, linesep_old);
      if(e){ *e = 0; e += strlen(linesep_old); };
      strcat(file_new, b);
      strcat(file_new, linesep_new);
      b = e;
   }

My question: if the behavior of line_end_convert() is changed this way
will that ruin something else for somebody? And if not can it be please
included in official release?

Yury.

On Sun, 2006-01-29 at 19:07 +0100, Richard Levitte - VMS Whacker wrote:
> 
> As far as I can see, monotone uses read_localized_data() and
> write_localized_data() at all times when reading and writing files
> that should go into and out off the database.  Those functions don't
> look at the state of the file, they only check if the internal and
> external line endings are the same, and if so, they don't do any
> conversion at all.  Same goes for character sets, BTW.
> 
> So, it's entirely up to the lua functions get_linesep_conv and
> get_charset_conv to figure out if the file is binary or not, given the
> filename argument.  Yury made the mistake of not checking anything,
> and lost therefore.
> 
> Personally, I find it incredibly dangerous that you can defined the
> internal database line ending character...
> 
> Cheers,
> Richard
> 
> -----
> Please consider sponsoring my work on free software.
> See http://www.free.lp.se/sponsoring.html for details.
> 




reply via email to

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