Bug 138419 - Copy of file opened in a fresh Writer window loses all chapter titles when updating table of contents
Summary: Copy of file opened in a fresh Writer window loses all chapter titles when up...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: TableofContents-Indexes
  Show dependency treegraph
 
Reported: 2020-11-23 00:47 UTC by Luke Kendall
Modified: 2022-03-15 16:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
The broken document, obfuscated (deleted)
2020-11-23 00:47 UTC, Luke Kendall
Details
The real obfuscated document (1.41 MB, application/vnd.oasis.opendocument.text)
2020-11-23 07:59 UTC, Luke Kendall
Details
Simple 20 page odt with three chapters and a table of contents. NO Bug. (18.85 KB, application/octet-stream)
2020-12-22 05:56 UTC, Peter S Anderson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kendall 2020-11-23 00:47:03 UTC
Created attachment 167488 [details]
The broken document, obfuscated

I've had my file open for weeks now, saving regularly, and it's looking good.
Unfortunately, today I copied it to a new file and opened that up, and found that all chapter titles had broken (when I chose to Update the TOC).
The file is identical to what I have open in another window.

The original file in the other window still has all chapter titles: I can see them (they appear as Chapter <N>, where Chapter is all caps and <N> is the chapter number). The TOC updates correctly. I can Navigate via Headers.

The identical copy of the original file has all chapter titles broken: they all appear as just <N>, the chapter number. If I Update Index on the TOC it vanishes. If I attempt to Navigate by Headers, Writer says "No headers".

A cmp of the files confirmed they were identical.

So I suspect the file in memory has become corrupt or broken and if I close and reopen it I will have lost all the chapter headings.  In the meantime I can create PDF versions from it as I require.

I have prepared an obfuscated version of the copied file. There's no point in providing the unobfuscated original because the only working version I have is the one in memory.
Comment 1 Telesto 2020-11-23 07:31:38 UTC Comment hidden (obsolete)
Comment 2 Luke Kendall 2020-11-23 07:40:41 UTC Comment hidden (obsolete)
Comment 3 Luke Kendall 2020-11-23 07:59:03 UTC
Created attachment 167497 [details]
The real obfuscated document

Please keep this one and delete the other.
Bizarrely, I made this file by turning off Record and Show changes, then running this regexp:

Find & replace (turn on regexps: MAKE SURE RECORD, SHOW changes is OFF!)

        Match case, regexp:
        [bcdfghjklmnpqrstvwyz]
        Replace with:
        x

(Which in the 7.x version took an hour or so, with Writer running 100% CPU and no indication of progress. I THINK the 6.x series took about 15 mins.)

Also very strange is the file size basically doubled in making this text replacement, which since it's a one char replacement by one char, suggests the XML parts of the document changed.

 1474442 Nov 23 11:42 LG-brokenChTitles-ReallyObfusc.odt
  711822 Nov 23 09:43 LG-brokenChTitles-NotReallyObfusc.odt
Comment 4 Timur 2020-11-23 12:16:55 UTC Comment hidden (obsolete)
Comment 5 Xisco Faulí 2020-11-23 21:10:44 UTC Comment hidden (obsolete)
Comment 6 Luke Kendall 2020-11-24 14:43:17 UTC Comment hidden (obsolete)
Comment 7 Peter S Anderson 2020-12-22 05:56:01 UTC
Created attachment 168397 [details]
Simple 20 page odt with three chapters and a table of contents. NO Bug.
Comment 8 Peter S Anderson 2020-12-22 05:57:39 UTC
The attached example file is very large (500 pages) with numerous notes. The document takes an exceedingly long time to load and includes a table of contents which displays when loaded. I was unable to recreate the table of contents either after loading or after copying to a new text document in 6.4.7.2 and 7.2 Dev.

I created a simple 20 page file with three chapters and a table of contents. When I copied the text to a new text document  I was able to recreate the table contents without problem. I did this in both 6.4.7.2 and 7.2 Dev without a problem. 

I suspect that there is something particular to the example file which may corrupt memory. My work was done using 64 bit Windows 10 laptop. Someone with a more powerful machine with more memory may have more luck reproducing the bug.
Comment 9 Buovjaga 2020-12-22 06:55:34 UTC
Steps:
1. Open attachment 167497 [details]
2. Go to the ToC on page 6, right-click and Update index

I reproduce with 6.3.0 (Linux) and 3.3.0 (Win)

Not sure about the perspectives of the issue regarding bug fixing, but setting to NEW for now.

Arch Linux 64-bit
Version: 7.0.3.1
Build ID: 00(Build:1)
CPU threads: 8; OS: Linux 5.9; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
7.0.3-2
Calc: threaded
Comment 10 Telesto 2020-12-22 07:25:35 UTC
FWIW.. file look round tripped through docx. somewhere in the process and maybe something to do with child heading style


and the file loads terrible slow compared to the original (deleted file)
Comment 11 Luke Kendall 2020-12-22 12:27:44 UTC
This is my book manuscript, and I am 99.999% sure I never round-tripped it to .docx and back again to .odt.

I consider such an operation unsafe in the extreme. Saving to .docx loses a lot if information, including changing pagination.  So it's not something I would willingly do, and I'm also very confident I never did that.

Note my original comment: when I copied the file (to obfuscate that copy), I noticed the error, yet the saved file and the copied file were identical according to Linux cmp.  So Writer must have suffered some corruption.

I can also add that I had a crash of Writer after some weeks with the document open, yet when I opened that version of the document I could update the TOC and there were no problems.

Pretty weird behaviour.

I also think that the 7.0 series is slower than the 6.4 series on long documents such as this with a lot of comments - though still far better than it used to be back in the 5.x series (which had an O(N^2) algorithm problem with no. of comments).
Comment 12 Timur 2022-03-14 10:06:05 UTC
I don't see bug here, apart from awful slowness. 
Chapter Title is not Outline and of course doesn't appear in ToC, unless you edit it.