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: Richard Levitte - VMS Whacker
Subject: Re: [Monotone-devel] Re: Bug in CRLF conversions
Date: Sun, 29 Jan 2006 19:07:50 +0100 (CET)

In message <address@hidden> on Sun, 29 Jan 2006 14:14:40 +0000, Bruce Stephens 
<address@hidden> said:

monotone> Yury Polyanskiy <address@hidden> writes:
monotone> 
monotone> > I think there is a bug in CRLF<->LF conversions or at
monotone> > least unintended behavior.
monotone> >
monotone> > Suppose the following scenario.
monotone> >
monotone> > function get_linesep_conv(fname)
monotone> >             return {"LF", "CRLF"}
monotone> > end
monotone> >
monotone> > I expect to have all files translated from LF to CRLF
monotone> > after checkout with this hook. Indeed that happens.
monotone> > However, suppose I have a binary file which is (in case of
monotone> > such a dumb hook) fed through line translation procedure.
monotone> > Then each occurence of 0x0a *OR* 0x0d is replaced by two
monotone> > bytes [0x0d 0x0a].
[...]
monotone> My first thought is that monotone shouldn't be using this
monotone> hook at all for binary files, should it?
monotone> 
monotone> [...]

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.

-- 
Richard Levitte                         address@hidden
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis




reply via email to

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