Bug 163154 - FILEOPEN DOCX Writer eats bookmark of the first legacy field
Summary: FILEOPEN DOCX Writer eats bookmark of the first legacy field
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: low minor
Assignee: Justin L
URL:
Whiteboard: target:25.2.0 target:24.8.3 target:24...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Fields
  Show dependency treegraph
 
Reported: 2024-09-25 17:24 UTC by Gabor Kelemen (allotropia)
Modified: 2024-10-04 07:25 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
The example file in Word 2016 and Writer master, with bookmarks visible (150.97 KB, image/png)
2024-09-25 17:24 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2024-09-25 17:24:48 UTC
Created attachment 196686 [details]
The example file in Word 2016 and Writer master, with bookmarks visible

This was noticed while looking at the example file bug 79435's attachment 100137 [details] (mentioned in bug 150037)

This docx has 4 legacy text fields and Word creates a bookmark for each of them.
Writer opens with only 3, making navigation to the first one difficult.

1. Open the above example file, look at the Navigator -> Bookmarks
-> There are 3 bookmarks listed instead of 4

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5b54f68599d9a9b6f4d21fd8c0cdac746ea71ecb
CPU threads: 14; OS: Windows 10 X86_64 (10.0 build 19045); UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: default

Seems to have started in 6.2 with:

https://git.libreoffice.org/core/+/579c0749bef8c980507229439715e72060c1b077%5E%21/#F2

commit 579c0749bef8c980507229439715e72060c1b077	[log]
author	Justin Luth <justin.luth@collabora.com>	Tue Oct 09 14:03:37 2018 +0300
committer	Justin Luth <justin_luth@sil.org>	Fri Oct 12 05:56:01 2018 +0200

tdf120224 writerfilter: consume excess bookmark from fields

Adding CC to: Justin Luth
Comment 1 Justin L 2024-09-27 23:22:41 UTC
Interesting - the difference is that the first bookmark comes after the field has already started [like how LO exports]
    <w:fldChar w:fldCharType="begin">
        <w:ffData>
            <w:name w:val="Text1"/>
    ...
    <w:bookmarkStart w:id="0" w:name="Text1"/>

while the other fields all start with the bookmark and then define the field
[which is how MS Word exports], and thus they didn't pass if(IsOpenField()).

If I understand this bug report correctly, there is no functionality break. It simply is a convenient fact that the legacy fields (which are not entities in the navigator sidebar) are typically wrapped with a bookmark (which IS an navigable entity).

On the other hand, the avoidance of reading the presumably-LO-exported bookmark was also a convenience factor that tried to mitigate previous bad export behaviour.

So I don't really see any reason why not to revert that commit...
Comment 2 Commit Notification 2024-09-28 18:47:41 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7f84c993d3d2b5f05b18e740fea960901da57f80

tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Justin L 2024-09-28 18:58:02 UTC
I don't see any reason to backport this...
Comment 4 Commit Notification 2024-09-30 10:25:36 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/9eacd3d6dda69b7c7c22c5168508287a10204b57

tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark

It will be available in 24.8.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2024-10-04 07:25:58 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/1a4baa7d2907a9a3317b25762cbe11ae27389fea

tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark

It will be available in 24.2.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.