Comment 20 for bug 525571

Revision history for this message
Vincent Ladeuil (vila) wrote : Re: [Bug 525571] Re: No locking when updating files in ~/.bazaar

>>>>> "Tim" == Tim Penhey <email address hidden> writes:

    Tim> On Mon, 28 Jun 2010 13:01:10 you wrote:
    >> Vincent, the corruption isn't a damaged file, its a file without
    >> content that another concurrent writer added.

Doesn't match the case reported in the bug description.

Well, if by 'file without content' you mean an empty section (aka only
the section header), it matches, but there is no code in configobj to
back this hypothesis (AFAICS, and if it was that may be in a bug in
bzr-svn, but I dont think so).

    Tim> Actually I think it is a damaged file as the config reader
    Tim> cannot read the new one.

More like it.

    Tim> Observations have shown it intermingles the lines, so instead
    Tim> of having:

I like the intermingled lines cause, thanks for giving weight to it :)

    Tim> [heading1]
    Tim> value=some value
    Tim> [heading2]
    Tim> value=some other value

    Tim> we end up with

    Tim> [heading1]
    Tim> [heading2]
    Tim> value=some value
    Tim> value=some other value

    Tim> and the reader blows up with duplicate keys.

But this example still presents complete sections which the reported one
doesn't:

[261e6e09-138e-40a9-b6e2-6d67e07423dd]
locations = file:///tmp/foo
istedmatrix.com/svn/Twisted
guessed-layout = trunk0
[261e6e09-138e-40a9-b6e2-6d67e07423dd]

Here, only the section header is written without any content to put
into (and *that* doesn't make sense).

One can imagine the first process writing its section, the second one
writing its own (explaining that the same section is created twice) and
then the first process truncating the file while closing it and doing so
losing part of the second process section... and finally a third process
crashing while trying to read the result

A bit far fetched though...

Especally when the python code to write such a file is:

            h = open(self.filename, 'wb')
            h.write(output)
            h.close()

'wb' line-buffered ? Huh ? Anyone with a live chicken to spare ?

Anyway, the fix I'm working on should cover this case, but still, seeing
a corrupted file may help reaching a better understanding.