Bug 60710 - EDITING: Cannot save particular document containing comments
Summary: EDITING: Cannot save particular document containing comments
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: Other Linux (All)
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:4.1.0 target:4.0.1
Keywords:
Depends on: 60738
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-12 04:07 UTC by webofht-libreofficebugs002
Modified: 2014-02-02 02:00 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
test doc (9.25 KB, application/vnd.oasis.opendocument.text)
2013-02-15 11:10 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description webofht-libreofficebugs002 2013-02-12 04:07:35 UTC
Problem description: Cannot save a particular untitled document containing comments in LibreOffice 4.

$ cat /opt/libreoffice4.0/program/versionrc
[Version]
AllLanguages=en-US
BuildVersion=
buildid=7545bee9c2a0782548772a21bc84a9dcc583b89
ExtensionUpdateURL=http://updateexte.libreoffice.org/ExtensionUpdateService/check.Update
ProductBuildid=103
ProductMajor=400
ProductMinor=0
ProductSource=OOO400
ReferenceOOoMajorMinor=3.4
UpdateID=LibreOffice_4_en-US
UpdateURL=http://update.libreoffice.org/check.php?pkgfmt=deb
UpdateUserAgent=<PRODUCT> (${buildid}; ${_OS}; ${_ARCH}; BundledLanguages=${AllLanguages})
Vendor=The Document Foundation

Steps to reproduce:
1. File -> New -> Text Document
2. Go to 
http://en.wikipedia.org/wiki/Valentine%27s_Day
3. Copy the text from 
Saint Valentine's Day, commonly known as Valentine's Day,[1]...
to 
... the latter date in honor of Hieromartyr Valentine, the Bishop of Interamna (modern Terni).[9][10]

4. In Writer -> Paste
5. Select Saint Valentine's Day -> Insert -> Comment
6. Type Use pink perhaps
7. Select pink -> Right-click pink -> Bold 
8. Select the text St. Valentine's Day
9. Insert -> Comment
10. Type Use red perhaps
11. Select red -> Right-click red -> Bold 
12. Select the text St. Valentine's Day
13. -> Font Color -> Light red
14. Select the text Saint Valentine's Day
15. -> Font Color -> Light magenta
16. Go to the first comment
17. -> Drop-Down Arrow -> Delete Comment
18. File -> Save as -> Save
19. The following error is shown:

Error saving the document Untitle2:
Write Error.
Error in writing sub-document content.xml.

The video is here:
http://youtu.be/9ImnaTY65gA


Current behavior:  Same as Problem description.

Expected behavior:  Can save the particular untitled document containing comments in LibreOffice 4.

Regards,

C. H. D.
Comment 1 Joel Madero 2013-02-12 16:04:21 UTC
This is really strange, it was reproducible once for me, but now I can't get it to happen again. I've tried at least a half dozen times....

Another QA member had the same experience :-/. Will play around with it a bit more but:

@Reporter - did it happen more than once for you? I even tried deleting my profile and starting from scratch and that didn't do it
Comment 2 webofht-libreofficebugs002 2013-02-13 03:20:16 UTC
See the video:

http://youtu.be/_XotQrTvGJM 


The file does not have to be an untitled file.
The file can be a saved file. Later, add more comments in a random manner to see the effect. It seems that this is a case. Delete one of the comments afterwards.
Comment 3 Joel Madero 2013-02-14 06:45:20 UTC
Adding writer experts to try to figure out how to reproduce this consistently. I was clearly able to one time and after that....can no longer. Very strange.

@pros - any ideas on this one? Very serious, I just can't reproduce it consistently enough to mark as NEW. Joren had a similar experience
Comment 4 webofht-libreofficebugs002 2013-02-14 14:45:43 UTC
I have reliably reproduced the issue four times 
by following the steps below:

1 aaa bbb xxx
3 aaa bbb xxx xxx
4 aaa bbb xxx ddd eee xxx
2 aaa bbb xxx xxx xxx

1. Copy the above lines -> In LibreOffice Writer -> Paste
2. Select aaa bbb (line numbered 1) -> Insert -> Comment -> Type 1
3. Select aaa bbb (line numbered 2) -> Insert -> Comment -> Type 2
4. Select aaa bbb (line numbered 3) -> Insert -> Comment -> Type 3
5. Select aaa bbb (line numbered 4) -> Insert -> Comment -> Type 4
6. Select ddd eee (line numbered 4) -> Insert -> Comment -> Type 4 again
7. Select the Drop-Down Arrow in comment with 4 (not 4 again)
8. Delete Comment
9. Save
10. Error

Error saving the document whatever:
Write Error.
Error in writing sub-document content.xml.
Comment 5 Michael Meeks 2013-02-14 16:16:22 UTC
Interestingly I can't reproduce the failure to write on Linux; but I do get some corruption - seemingly deleting the first "4" comment makes the "4 again" comment not a range based comment, but a point comment at the end.

ie. a save + restore doesn't restore this to where it should be.

I guess this is another case of mis-managing the field-marks underlying the code ?

webofht - do you have a debug symbols build you could run valgrind in to see if there is some memory corruption there ?

Miklos you did a few fixes in this area recently; any thoughts ? :-)
Comment 6 webofht-libreofficebugs002 2013-02-15 01:57:18 UTC
(In reply to comment #5)
> Interestingly I can't reproduce the failure to write on Linux; but I do get
> some corruption - seemingly deleting the first "4" comment makes the "4
> again" comment not a range based comment, but a point comment at the end.

Please watch the video to see if the steps are correct:

http://youtu.be/sIZJMoUXXUk
Comment 7 Miklos Vajna 2013-02-15 11:07:43 UTC
Yes, I can reproduce this bug, following the steps from comment 4.
Comment 8 Miklos Vajna 2013-02-15 11:10:41 UTC
Created attachment 74866 [details]
test doc

Open the attached file, delete comment "4", then xmloff fails to save the file.
Comment 9 Joel Madero 2013-02-15 20:45:28 UTC
Miklos - can we assign you to this one?
Comment 10 Miklos Vajna 2013-02-16 11:52:55 UTC
Yes, I just did so.
Comment 11 Not Assigned 2013-02-18 10:44:51 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

fdo#60710 SwXTextPortionEnumeration: filter out fields from the undo stack



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 12 Miklos Vajna 2013-02-18 11:20:53 UTC
Erm, just to correct comment 8, you need to delete "4 again" to trigger the issue.
Comment 13 Miklos Vajna 2013-02-18 11:24:28 UTC
-4-0 review: https://gerrit.libreoffice.org/2231
Comment 14 Not Assigned 2013-02-18 22:31:43 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

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

fdo#60710 SwXTextPortionEnumeration: filter out fields from the undo stack


It will be available in LibreOffice 4.0.1.

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 15 webofht-libreofficebugs002 2014-02-02 02:00:24 UTC
Confirm that this issue is fixed in LibreOffice Version: 4.2.0.4 (Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71).