Bug 77342 - EDITING: Endnote reference corruption after copy+paste
Summary: EDITING: Endnote reference corruption after copy+paste
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.5.3 release
Hardware: Other All
: high major
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: BSA confirmed:4.2.3.3:Win7 confirmed:...
Keywords: regression
Depends on:
Blocks:
 
Reported: 2014-04-11 19:49 UTC by Kartik Subbarao
Modified: 2015-08-21 21:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
zip file with endnotes.odt and endnotes-corrupted.odt (24.60 KB, application/zip)
2014-04-11 19:49 UTC, Kartik Subbarao
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kartik Subbarao 2014-04-11 19:49:42 UTC
Created attachment 97238 [details]
zip file with endnotes.odt and endnotes-corrupted.odt

Problem description: In the first document attached (endnotes.odt), if I copy and paste the word "Notes" before the word "Refs", the second endnote reference suddenly changes from 3 to 1. If I then save the file, the result is endnotes-corrupted.odt.

I have isolated this text from a large book that I'm currently working on, which has several sections. If I cut and paste text seemingly anywhere in the document, a number of endnotes suddenly become corrupted.

As you can imagine, this behavior is causing challenges for editing -- a fix and/or workaround would be greatly
appreciated :-)

Steps to reproduce:
1. Open endnotes.odt
2. Copy+paste the word "Notes" before the word "Refs"
3. Observe that the second endnote reference changes from 3 to 1
              
Operating System: All
Version: 4.2.2.1 release
Comment 1 V Stuart Foote 2014-04-12 15:40:58 UTC
On Windows 7 sp1, 64-bit

Can confirm with current build of master
Version: 4.3.0.0.alpha0+
Build ID: 83c888bdb0a6c9795cebfc53fa74d6da8bb692b2
TinderBox: Win-x86@47-TDF, Branch:MASTER, Time: 2014-04-10_20:33:35

and with Version: 4.2.3.3
Build ID: 6c3586f855673fa6a1576797f575b31ac6fa0ba3

To clarify just a bit, appears that the endnotes remain intact, but references made to an endnote is expectantly changed with a paste is made into the text holding the reference.
 
And when the reference is changed it is still an intact reference, but now pointing to the wrong endnote--one corresponding to its identifier (numbers in this example). The changed reference object's "points to" remains correct but the change of reference to a different endnote object is horribly wrong.

The change occurs when text copied from the LibreOffice clipboard is pasted. 

A <CTRL>+Z undoes the paste, but will not back out the change of reference, i.e. data corruption.

A paste of system clipboard text or objects (from outside the document) does not seem to cause the change of the reference.

Use of paste special does not appear to avoid corruption of reference.
Comment 2 V Stuart Foote 2014-04-12 15:47:40 UTC
Setting as regression, 4.0 --> 4.1

Corruption of references not apparent on Windows 7 sp1, 64-bit for
Version 4.0.6.2 (Build ID: 2e2573268451a50806fcd60ae2d9fe01dd0ce24)

But the issue is present by
Version: 4.1.5.3
Build ID: 1c1366bba2ba2b554cd2ca4d87c06da81c05d24
Comment 3 Kartik Subbarao 2014-04-12 19:16:19 UTC
Thanks for the quick response. Using the portable versions on downloadarchive.documentfoundation.org, I was able to isolate it some more. 4.1.4.2 doesn't have this problem, so it looks like the regression happened somewhere during the 4.1.5.x releases.
Comment 4 V Stuart Foote 2014-04-13 06:42:25 UTC
Yes, confirming that issue is not present in 
Version: 4.1.4.2
Build ID: 0a0440ccc0227ad9829de5f46be37cfb6edcf72

but was introduced for 4.1.5.3

That would place it in the range of commits
http://cgit.freedesktop.org/libreoffice/core/log/?h=libreoffice-4-1-5&qt=range&q=0a0440ccc0227ad9829de5f46be37cfb6edcf72..1c1366bba2ba2b554cd2ca4d87c06da81c05d24

But this looks to be the culprit
http://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-4-1-5&id=718524619bf8cc96325aed87b72735741fe93912

Michael?
Comment 5 V Stuart Foote 2014-04-13 14:13:55 UTC
(In reply to comment #1)

Have to start proof reading my posts a bit closer before saving...

> To clarify just a bit, appears that the endnotes remain intact, but
> references made to an endnote is expectantly changed with a paste is made
> into the text holding the reference.

s/expectantly changed with/unexpectedly changed when/
Comment 6 Michael Stahl (allotropia) 2014-04-17 13:35:07 UTC
fixed on master
Comment 7 Commit Notification 2014-04-17 14:14:33 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=e8252361548e3ca7849ced1a31d90fa5e5aacb09&h=libreoffice-4-2

fdo#77342: sw: fix copy/paste of footnote cross references


It will be available in LibreOffice 4.2.5.

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 8 Commit Notification 2014-04-17 14:16:02 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4786291566320aaf21fe4c9a7fb52269ddba4f3c&h=libreoffice-4-1

fdo#77342: sw: fix copy/paste of footnote cross references


It will be available in LibreOffice 4.1.7.

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 Kartik Subbarao 2014-04-17 16:53:08 UTC
Thanks guys!
Comment 10 Commit Notification 2014-04-22 13:09:37 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-1-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=96c60b814c487a23aa7d1ae8db4407304a50b097&h=libreoffice-4-1-6

fdo#77342: sw: fix copy/paste of footnote cross references


It will be available already in LibreOffice 4.1.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 Commit Notification 2014-04-24 14:16:11 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-2-4":

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

fdo#77342: sw: fix copy/paste of footnote cross references


It will be available already in LibreOffice 4.2.4.

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 Commit Notification 2015-08-21 21:06:31 UTC
Varun committed a patch related to this issue.
It has been pushed to "master":

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

Added Test for tdf#77342 copy/paste of footnote cross references

It will be available in 5.1.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.