Bug 78758 - Saving file with TOC as .rtf corrupts document
Summary: Saving file with TOC as .rtf corrupts document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.0.alpha1
Hardware: All All
: low major
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:4.4.0 target:4.3.0.2 target:4.2.6
Keywords: bibisected, regression
Depends on:
Blocks:
 
Reported: 2014-05-15 20:00 UTC by raal
Modified: 2016-06-15 14:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
test files (210.31 KB, application/x-7z-compressed)
2014-05-15 20:00 UTC, raal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description raal 2014-05-15 20:00:50 UTC
Created attachment 99128 [details]
test files

Steps to reproduce:
open .DOC file in LibreOffice (file "original file.doc")
Save as - RTF file (file (file "exported to RTF with LibreOffice.rtf")
open this file in Word 2010  - error file is corrupted
open this file in LibreOffice - error (file "Lo error.png")

When I delete table of contents, then export to RTF is correct.

Tested on:
Version: 4.3.0.0.alpha1+
Build ID: 668c6dd0c3e9fa87affe2fa4c6772fb95f19e2ae
TinderBox: Linux-rpm_deb-x86@45-TDF, Branch:master, Time: 2014-05-12_22:40:44

LO Portable Win7: 4.2.4.2
ID sestavení: 63150712c6d317d27ce2db16eb94c2f3d7b699f8
Comment 1 Joel Madero 2014-05-16 01:14:54 UTC
Thank you for reporting this issue! I have been able to confirm the issue on:
Version 4.2.4.2 
Platform: Ubuntu 14.04
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
As I've been able to confirm this problem on an earlier release I am changing the version number as version is the earliest version that we can confirm the bug, we use comments to say that the bug exists in newer versions as well.

Marking as:

New (confirmed)
Major - prevents use of rtf file with table of contents
Low - non-native format that isn't used by the vast majority of users.


Note: If you have time to check to see if this has ever worked it would be nice to know if it's a regression or not. http://downloadarchive.documentfoundation.org/libreoffice/old/

If you can confirm on older versions update the version to the oldest confirmed version. Thanks!

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 2 Joel Madero 2014-05-16 01:31:53 UTC
Nevermind - I've confirmed this is indeed a regression.
 c11c0d3e659503838fafb8c01ada0ee547ed708a is the first bad commit
commit c11c0d3e659503838fafb8c01ada0ee547ed708a
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Wed Nov 27 07:05:06 2013 +0000

    source-hash-3347f41a9b13c317c1d001e7ff501a4b0ee8f896
    
    commit 3347f41a9b13c317c1d001e7ff501a4b0ee8f896
    Author:     Kohei Yoshida <kohei.yoshida@collabora.com>
    AuthorDate: Wed Oct 23 13:17:00 2013 -0400
    Commit:     Kohei Yoshida <kohei.yoshida@collabora.com>
    CommitDate: Wed Oct 23 15:44:12 2013 -0400
    
        Avoid exposing the internal cell note storage outside ScDocument.
    
        Let's try to avoid including mtvelements.hxx in document.hxx...
    
        mtvelements.hxx is very parser-heavy, and document.hxx is included
        everywhere...
    
        Change-Id: I2768ba6e25f8ff10f61f9cfd4a7cbc4844230630

:100644 100644 7f9428c851b64605d78ff041a8ef2390db6ed7d7 d466ded23406425d7d460a296e3ffa43ccad7986 M	ccache.log
:100644 100644 b08ddbbe6b4c1a704226c9591da17245286a6ab0 449bd7891d4bc48ae1bfb394bd7a3b37a804dda9 M	commitmsg
:100644 100644 f202cdf6fb8d17505a2694eed4867bb6deb9ae9d a98e593e485d4dda43b7ddb9a77732d3e82ffe53 M	make.log
:040000 040000 543ce334ef95614317a778006afc160215a144e3 5a04653424cd190c25b54d9394a24451087d47d7 M	opt


# bad: [793dbf6f80f497dfe587d560d6257f42a24273f6] source-hash-1581b1fc3ac82a7bd62df968226e98604a4ca52d
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# good: [8092559c5013969ebda017d79200463b9b975038] source-hash-fd84daf696a368c2c7561b5253b32a63ecdeca4a
git bisect good 8092559c5013969ebda017d79200463b9b975038
# good: [0270ef1b76a6de423b30f7927362cc01c1a0fc38] source-hash-b1f7dd66b898b03cb4bd8d434b6370310ea95946
git bisect good 0270ef1b76a6de423b30f7927362cc01c1a0fc38
# skip: [ddb123cad22440994cd332d9985dd9558fd07e07] source-hash-647fb29f528b891a1c92846640f7865f5c1fbe7f
git bisect skip ddb123cad22440994cd332d9985dd9558fd07e07
# skip: [9d357dc6201f7cd91448595e0a3f89dfdae81946] source-hash-2304beaca33c63b94df99cb827716f00ce259f9a
git bisect skip 9d357dc6201f7cd91448595e0a3f89dfdae81946
# good: [ef72aa34cf4ee6399b192de28708d621c9680a50] source-hash-7e07a45500dcbb891a85f0bc9b7049cf4d50bba1
git bisect good ef72aa34cf4ee6399b192de28708d621c9680a50
# good: [2472598a0b04eef3038d56137f27dc6dc1edf9e5] source-hash-5050dfc73f194d1d59222cac72e69a917655d816
git bisect good 2472598a0b04eef3038d56137f27dc6dc1edf9e5
# skip: [b25c77bc097fa4cc84f59ebdd34011bafbb3a770] source-hash-660800d6f33a01ad53fc0f5717e1c33868440d2f
git bisect skip b25c77bc097fa4cc84f59ebdd34011bafbb3a770
# skip: [b25c77bc097fa4cc84f59ebdd34011bafbb3a770] source-hash-660800d6f33a01ad53fc0f5717e1c33868440d2f
git bisect skip b25c77bc097fa4cc84f59ebdd34011bafbb3a770
# bad: [89c7af972191d30321e9503b6454e8b1570ee3e8] source-hash-0aa9ced531b8d85ad067c1d156a9708eea628d78
git bisect bad 89c7af972191d30321e9503b6454e8b1570ee3e8
# bad: [89c7af972191d30321e9503b6454e8b1570ee3e8] source-hash-0aa9ced531b8d85ad067c1d156a9708eea628d78
git bisect bad 89c7af972191d30321e9503b6454e8b1570ee3e8
# bad: [89c7af972191d30321e9503b6454e8b1570ee3e8] source-hash-0aa9ced531b8d85ad067c1d156a9708eea628d78
git bisect bad 89c7af972191d30321e9503b6454e8b1570ee3e8
# good: [5739508e8ebb108f7a2c38e0e8567075752f06ba] source-hash-43ccd83d2598256de2193348c0b3c7f85fb4870e
git bisect good 5739508e8ebb108f7a2c38e0e8567075752f06ba
# good: [5739508e8ebb108f7a2c38e0e8567075752f06ba] source-hash-43ccd83d2598256de2193348c0b3c7f85fb4870e
git bisect good 5739508e8ebb108f7a2c38e0e8567075752f06ba
# bad: [1fe9a0d448a595c2dc32488a1d18b3d3a3566101] source-hash-8f0ecf253531963144d3d1c9ee5c12a6cda99c4e
git bisect bad 1fe9a0d448a595c2dc32488a1d18b3d3a3566101
# bad: [1fe9a0d448a595c2dc32488a1d18b3d3a3566101] source-hash-8f0ecf253531963144d3d1c9ee5c12a6cda99c4e
git bisect bad 1fe9a0d448a595c2dc32488a1d18b3d3a3566101
# bad: [339f7a845817b64f96d606e2991b93bc5af970aa] source-hash-5d0051efb99c6cbd0dc4dd655a71e7435159f6bc
git bisect bad 339f7a845817b64f96d606e2991b93bc5af970aa
# good: [13b57ec8e3cf883af6e883cfa35581addee82599] source-hash-03e9845525037a02dac320ad09fb6eed34e9f0da
git bisect good 13b57ec8e3cf883af6e883cfa35581addee82599
# bad: [c11c0d3e659503838fafb8c01ada0ee547ed708a] source-hash-3347f41a9b13c317c1d001e7ff501a4b0ee8f896
git bisect bad c11c0d3e659503838fafb8c01ada0ee547ed708a
# first bad commit: [c11c0d3e659503838fafb8c01ada0ee547ed708a] source-hash-3347f41a9b13c317c1d001e7ff501a4b0ee8f896
Comment 3 Tobias Lippert 2014-05-17 10:33:01 UTC
There seem to be issues with saving documents with table of contents in .odt also.

Steps to reproduce:
1. Create a new document
2. enter "asdf" on a line
3. make that line "Header 1"
4. Create a new line before the entered text
5. Insert > Indexes and Tables > Indexes and Tables
6. Press OK
--> asdf appears in table of contents
7. Save document
8. File > Reload
9. Rightclick on Table of contents, choose "Update Index/Table"
--> asdf disappears from table of contents

If I open the file with the 4.2.4.2-8.fc20 version, and do step 9., the error persists.
If I do all steps with 4.2.4.2-8.fc20, asdf does not disappear.
Comment 4 Joel Madero 2014-05-17 14:24:58 UTC
Can you update the title to reflect this new info? Thanks!
Comment 6 Michael Stahl (allotropia) 2014-06-17 22:04:14 UTC
hmmm the patch in comment #5 is the culprit...

the offending paragraph is in line 139 and has a triplicate \fldrslt with imbalanced braces:

\par \pard\plain \s37\ql\nowidctlpar\ltrpar\cf0\dbch\af5\dbch\af5\afs24\alang1025\loch\f5\fs24\lang1029\tldot\tqr\tx6681{{\field{\*\fldinst HYPERLINK "#__RefHeading___Toc264438068" }{\fldrslt \langfe1024\rtlch \ltrch\loch\lang1024
E\u344\'d8\u205\'cdE5E EeEEE5EE}}}{{\fldrslt \scaps\langfe1024\rtlch \ltrch\loch\lang1024
\u8217\'92e}{{\fldrslt \langfe1024\rtlch \ltrch\loch\lang1024
\tab 46}


before it looked like:

\par \pard\plain \s37\ql\nowidctlpar\ltrpar\cf0\dbch\af5\dbch\af5\afs24\alang1025\loch\f5\fs24\lang1029\tldot\tqr\tx6691{{\field{\*\fldinst HYPERLINK "#__RefHeading__35_249970428" }{\fldrslt \rtlch \ltrch\loch
E\u344\'d8\u205\'cd}{\rtlch \ltrch\loch
}}E5E EeEEE5EE\u8217\'92e}
Comment 7 Michael Stahl (allotropia) 2014-06-27 14:21:50 UTC
fixed on master
Comment 8 Commit Notification 2014-06-27 14:23:02 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b8907bf3d3b37c686a414ffbbd2d732348aab5b9

fdo#78758: sw: RTF export: don't export multiple \fldrst for one hyperlink



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2014-06-29 10:48:12 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=04b5dd4d5080c5ffc0666dcfc62bda78170ba74c&h=libreoffice-4-3

fdo#78758: sw: RTF export: don't export multiple \fldrst for one hyperlink


It will be available in LibreOffice 4.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2014-07-02 08:23:22 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f9d7927c615a0998456f2d72b4d88c16a0314c24&h=libreoffice-4-2

fdo#78758: sw: RTF export: don't export multiple \fldrst for one hyperlink


It will be available in LibreOffice 4.2.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Luke 2014-11-26 20:21:54 UTC
This bug appears to be fixed when viewed in Writer, but if you try to open the RTF test file created by Writer in Word, the resulting RTF has a corrupt TOC. If you want to reopen this bug to address this issue, please close Bug 86751 as a dupe.
Comment 12 Michael Stahl (allotropia) 2014-11-26 22:20:28 UTC
after so many months a new bug is better, thanks...
and if the file does open at all in Word i'm calling that progress :)
Comment 13 Robinson Tryon (qubit) 2015-12-17 08:06:10 UTC
Migrating Whiteboard tags to Keywords: (bibisected)
[NinjaEdit]