On 10/07/2013 02:10 PM, Enrico Forestieri wrote:
On Sun, Oct 06, 2013 at 12:09:50PM -0400, Richard Heck wrote:
I just wanted to call everyone's attention to this bug:
http://www.lyx.org/trac/ticket/8854
It appears to be a very nasty dataloss bug in 2.1-beta1. What seems
to be happening is that, on save, the LyX file is corrupted in very
weird ways, with random parts of the file being replaced by things
like "mathnorma" or "Plain La"---fragments of things that do make
sense in other contexts.

A report of what looks like the same bug in 2.0.6 is here:
http://tex.stackexchange.com/questions/134009/lyx-inserts-and-removes-words-randomly
That was on Windows, as well, whereas #8854 is on Ubuntu. Another
difference is that #8854 seems to show up only on export. The
original report was of corruption in the exported 2.0 file, but by
looking in the temporary directory we found that the 2.1 file was
already corrupt. That makes it sound as if the problem has to do
with background export. But the 2.0.6 report seems to concern just
saving the file and not export.

The reporter has done some excellent work to help us figure this
out, but neither Pavel nor I have been able to reproduce---though
the reporter sees it all the time. It would really, really help if
someone could manage to reproduce this.

Obviously, it would also help if someone has a good idea what might
cause this.
I can reproduce this bug on several platforms and I am surprised that
nobody else can.

The problem here is that to_utf8() (and most probably all other
conversion routines) is not thread safe, maybe due to the static
output buffer in iconv_convert().

This is demonstrated by the attached quick and dirty patch. Without
this patch, I get a good export only about once every ten trails.
With the patch the exported file is always correct.


Great work, Enrico. I've posted the patch to the bug report. We'll see what the reporter has to say.

It is very strange that I can't reproduce, if this is the cause, and, indeed, that people haven't been seeing this bug all along.

The StackExchange report seems not to have concerned export, but just saving. I've asked there if that is correct.

Richard

Reply via email to