Issue 126330 - Adding comments to headers leads to an error in styles.xml corrupting the document
Summary: Adding comments to headers leads to an error in styles.xml corrupting the doc...
Status: CLOSED DUPLICATE of issue 128356
Alias: None
Product: Writer
Classification: Application
Component: formatting (show other issues)
Version: 4.1.1
Hardware: All All
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-25 22:41 UTC by marcus.defren
Modified: 2021-02-14 15:38 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
bugged testfile (9.41 KB, application/vnd.oasis.opendocument.text)
2015-11-02 11:53 UTC, marcus.defren
no flags Details
Verification that corruption happens with comments on highlighted text in Headers/Footers (47.13 KB, application/x-zip-compressed)
2019-05-11 17:05 UTC, Monica Arzani
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description marcus.defren 2015-05-25 22:41:42 UTC
I had a document with different page styles. The document used different headers (more than 1). Using the comment function I noticed it won't save the formatting info of the comments used in headers. (I made some words bold.)

Now if I apply comments to at least 2 different headers (which is possible with the different page styles allowing for different headers) and save the document then it will result in an error in styles.xml.

Something with duplicate attributes in office:name - that info I got when I examined the .xml with some tools. Unfortunately I don't know much about XML to give more info. It was possible to repair the file by deleting some stuff (the duplicate attributes so there was only 1 left).

Seems the info for multiple headers is saved at 1 place (where it creates these multiple attributes leading to a bug). Possible that this also is a problem for footers(not tried yet).

Should be fixed or at least - until it is possible to fix it - the comment function disabled in headers/footers.

If you want to try reproducing:
1. New document, manual page break(from the menu) and using a different page style on next page.
2. Enabling headers on both pages.
3. Adding comments to both headers (you should have 2 pages, each a different page style, each a different header, each one with at least 1 comment).
4. Save.
5. Try reopening -> Error message should appear.
Comment 1 jgollert2013 2015-09-23 01:49:38 UTC
I could not replicate this report using a Windows 10 computer on Open Office version 4.1.1 following these steps:

1. Creating a new document
2. Inserting a manual page break using Insert > Manual Break > Selecting Page Break and a style other than default > OK
3. Enabling headers via Insert > Header > All
4. Adding a comment to each header using Ctrl + Alt + C
5. Save
6. Close program and reopen
7. Attempt to load the file

Using these steps, the file loaded as expected with no error message. I attempted multiple combinations of styles installed with the program but still no error message. 
I tried to replicate the initial issue by adding text to the comments and making one comment bold which also resulted in the file loading fine.
I even attempted to add additional pages with different styles to the file, up to using all of the default installed styles on a unique page at once; but still the program was able to load the file with no issues. 

If possible, providing a file that replicates the error would be helpful to see if others have the same issue with the file.
Comment 2 marcus.defren 2015-11-02 11:53:13 UTC
Created attachment 85093 [details]
bugged testfile

I tried this again. At first I couldn't replicate it anymore. Then I tried something additional I did not mention here. Seems it is relevant to reproduce the bug. I must have done it all the time but when writing the report I forgot to add it because I thought it was not relevant.

Before adding the comments try to add some text in the headers and mark it. (So the commend refers to the marked text.) With this it should lead to the bug.

I'll upload a file with the bug with this post.
Comment 3 anthony 2016-03-01 20:51:33 UTC
I was successful in replicating this bug. In my tests of this issue I found that multiple comments on header or footer text results in the corruption of the saved documents styles.xml sub-document regardless of multiple page styles. The corruption occurs from either multiple comments on text in a single header and/or footer as well as the case of separate comments on text in separate headers and/or footers separated by a change in page style. The corruption occurs regardless of whether the same or separate words commented on. Comment replies are not effected and neither are comments placed at a location in the text as opposed to the comment being placed on a highlighted character string. Combining a highlighted character string comment and a location or reply comment does not result in a corruption either. This issue was replicated on Windows 10 using Apache Open Office Writer Ver. 4.2.0, Build: 9800, Rev:1692551.


Error Messages:

For header comments: (two comments to one header or one comment each on two separate headers)

Read Error. Format error discovered in the file in sub-document styles.xml at 2,10683 (row,col).

For footer Comments: (two comments to one footer or one comment each on two separate footers)

Read Error. Format error discovered in the file in sub-document styles.xml at 2,10684 (row,col).

For Both headers and footers: (one comment each on two separate headers and footers)

Read Error. Format error discovered in the file in sub-document styles.xml at 2,11074 (row,col).

For Both headers and footers: (multiple comments on a single header and footer)

Read Error. Format error discovered in the file in sub-document styles.xml at 2,11075 (row,col).

Replication:

Multi-comments on a single Headers/footers:
1)	Open a new open office writer text doc.
2)	Add a header to the file via: Insert > Headers or Footer > Default
3)	Add some text to the header or footer
4)	Highlight the text and add a comment (crtl + alt + c)
5)	Highlight the same or another piece of text and add another comment (crtl + alt + c)
6)	Save the doc and close writer.
7)	Open the saved doc.

Multi-comments on multiple Headers/Footers:
1)	Open a new open office writer text doc.
2)	Open the page break options via: Inset > Manual break
3)	Select another style from the style selection drop box and select ok.
4)	Add headers or Footers to the file via: Insert > Headers or Footers > All
5)	Add some text to both headers or footers
6)	Highlight the text of one header or footer and add a comment (crtl + alt + c)
7)	Highlight the text of another header or footer and add another comment (crtl + alt + c)
8)	Save the doc and close writer.
9)	Open the saved doc.
Comment 4 Monica Arzani 2019-05-11 17:05:42 UTC
Created attachment 86683 [details]
Verification that corruption happens with comments on highlighted text in Headers/Footers


Attachment: TestMonica.zip

Issue still present on my configuration:
ApacheOpenOffice 4.5.0 AOO450m1(Build:9900)  -  Rev. 1857900
Rev.1857900
System spec: 
* Processor: Intel(R) Core(TM) i7-6820HQ CPU @2.70GHz 
* Installed memory (RAM): 16.0 GB
* System type: 64-bit Operating system (Windows 7)
* Processor Graphics in Use: Intel(R) HD Graphics 530

I was able to replicate the issue with steps from marcus.defren@gmail.com and anthony.

I did some follow up tests to identify if  one of the critical steps is “Highlight the text and add a comment”. The file does get corrupted when multiple comments are on highlighted text, but not when comments are on blank spaces.

Similar tests on Footers show the same behaviour (corrupted file when multiple comments are made on highlighted text and normal behaviour when comments are on blank spaces). Repro steps are at the end of the description.
Saving the file in OpenOffice.org XML 1.0 Test Document (.sxw) and keeping chosen format shows the same behaviour as when saved in .odt. (attachment Test2.sxw and Test3_Corrupted.sxw)
I executed as well some tests with comments on footnotes, but the file was not corrupted in any case.

#
Test 1: Multiple comments on highlighted text in header on single page

Actual result:  File corrupted - attachment Test1_Corrupted.odt
Read-Error.
Format error discovered in the file in sub-document styles.xml at 2,10628 (row,col).

Repro steps:

1) Create new Writer document
2) Insert > Header > Default
3) Type some words in the header (eg. “Header 1”)
4) Insert comment by highlighting part of the text (eg. select “Header” and press Ctrl+Alt+C) and type a comment
5) [OPTIONAL] Save in .odt format
6) [OPTIONAL]  Close file
7) [OPTIONAL]  Reopen file with OO Writer -> File is correctly opened 
8) Add a second comment by highlighting part of the text in the header  (eg. select “1” and press Ctrl+Alt+C) and type a comment
9) Save in .odt format
10) Close file
11) Reopen file with OO Writer -> File is corrupted

To reduce the steps, open Test1.odt attachment and start from step 8).
Steps 5 to 7 are only to show the correct behaviour.

#
Test 2: Multiple comments on blank space in header on single page
Actual result: File is correctly opened - attachment Test2.odt

Execute steps as in Test 1. Change following steps:

4) Insert comment after a word in the text (eg. select space after “Header” and press Ctrl+Alt+C)
8) Add a second comment after a word in the text (eg. select space after “1” and press Ctrl+Alt+C)

After saving and closing, the file is correctly reopened - 

#Test 3: One comment per header on highlighted text on multiple page document (different headers)

Actual result:  File corrupted - attachment Test3_Corrupted.odt
Read-Error.
Format error discovered in the file in sub-document styles.xml at 2,11053 (row,col).

1) Create new Writer document
2) Add a second page (Insert > Manual break > Page break or press enter multiple times)
3) Insert different headers with Format > Page... > Header, select “Header on” and deselect “Same content left/right”. Press ok.
4) Type some words in the first page header (eg. “Header 1”) -> second header is left blank
5) Type some words in the second page header (eg. “Header 2”) -> second header is different from first header as expected.
6) Insert comment in first header by highlighting part of the text (eg. select “Header 1 ” and press Ctrl+Alt+C) and type a comment
7)  [OPTIONAL]  Save in .odt format
8)  [OPTIONAL]  Close file
9)  [OPTIONAL]  Reopen file with OO Writer -> File is correctly opened 
10) Insert comment in second header by highlighting part of the text (eg. select “Header 2 ” and press Ctrl+Alt+C) and type a comment
11) Save in .odt format
12) Close file
13) Reopen file with OO Writer -> File is corrupted

To reduce the steps, open Test3.odt attachment and start from step 10).
Steps 7 to 9 are only to show the correct behavior.
Comment 5 Arrigo Marchiori 2021-02-13 14:36:10 UTC
Thank you for reporting this bug... a long time ago.

The proposed solution is on bug 128356. Please let's follow up there.

*** This issue has been marked as a duplicate of issue 128356 ***