Bug 106218

Summary: Compare documents results in an extra paragraph at the end of the file
Product: LibreOffice Reporter: Caolán McNamara <caolan.mcnamara>
Component: WriterAssignee: Michael Stahl (allotropia) <michael.stahl>
Status: RESOLVED FIXED    
Severity: normal CC: andreamussap, michael.stahl
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bz.apache.org/ooo/show_bug.cgi?id=101009
Whiteboard: target:5.4.0 target:5.3.2
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 89903    
Attachments: one.odt
two.odt
one.odt
If the change is not in the last line, no parag is inserted
If the change is at the end of the file, parag is inserted

Description Caolán McNamara 2017-02-27 14:43:08 UTC
Description:
comparing two documents which are the same except for added content at the end results in a document with change tracking which when rejected doesn't result in the original document

Steps to Reproduce:
1. load two.odt
2. edit->track changes->compare document one.odt
3. reject all

Actual Results:  
"one
"

Expected Results:
"one"


Reproducible: Always

User Profile Reset: No

Additional Info:
reject all is just used to illustrate the problem. The real problem is that the extra paragraph in the document with change tracking will cause edit->track changes->merge documents to reject it as unmergeable as there are extra nodes in the document vs the original one.odt


User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
Comment 1 Caolán McNamara 2017-02-27 14:44:21 UTC
Created attachment 131511 [details]
one.odt
Comment 2 Caolán McNamara 2017-02-27 14:45:04 UTC
Created attachment 131512 [details]
two.odt
Comment 3 Caolán McNamara 2017-02-27 14:46:07 UTC
Created attachment 131513 [details]
one.odt
Comment 4 Caolán McNamara 2017-02-27 14:47:19 UTC
caolanm->mstahl: any ideas about how to make this work right ?
Comment 5 Andrea Mussap 2017-02-27 21:23:59 UTC
I've update the title from (compare documents and reject all changes results in an extra paragraph) to (Compare documents results in an extra paragraph at the end of the file)
Comment 6 Andrea Mussap 2017-02-27 21:25:33 UTC
Created attachment 131519 [details]
If the change is not in the last line, no parag is inserted
Comment 7 Andrea Mussap 2017-02-27 21:26:12 UTC
Created attachment 131520 [details]
If the change is at the end of the file, parag is inserted
Comment 8 Andrea Mussap 2017-02-27 21:34:53 UTC
Tested in version 5.3.0.3

Bug confirmed  - with Notes: This bug occurs when your update (either Accept or Reject) is concerned to the last line of the file.

Test:
1) Have two files: Test1 and Test2.
2) Open Test2, Edit > Track changes > Compare document... > select Test1 
3) Accep or Reject changes in different lines, positions of the document.

Pay attention that if your update is not at the last line of the file, the "extra" paragraph will not be inserted at the end of the file.

Result: 
No matter if you Accept or Reject the changes, if your update is at the end of the file, in it's last line, LO WILL insert a paragraph there. 

(see ChangesAtTheLastLine-Paragraph-Is-Inserted.png)

On the other hand, no matter if you Accept or Reject the changes, if your updates are anywhere but the end of the file, the "extra" paragraph will not be included.

(see ChangesNotInTheLastLine-NoParagraphInserted.png)
Comment 9 Michael Stahl (allotropia) 2017-03-07 22:41:37 UTC
looks like a regression from:

commit f4609c4c294a62023b6cd6baeb6a73d44992dec3
Author:     Michael Stahl <mst@openoffice.org>
AuthorDate: Mon May 17 15:50:18 2010 +0200

    sw33bf04: #i101009#: doccomp.cxx: avoid creating redlines including EndOfContent

very special case, that...

hopefully fixed on master
Comment 10 Commit Notification 2017-03-07 22:42:41 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#106218 sw: compare document: tweak special handling of EndOfContent

It will be available in 5.4.0.

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 Commit Notification 2017-03-08 10:17:16 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a990b46ccc788db45ff4d8f0d47b799782ecb2af&h=libreoffice-5-3

tdf#106218 sw: compare document: tweak special handling of EndOfContent

It will be available in 5.3.2.

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.