Bug 158977 - FILEOPEN: DOCX: header/footer has text when it shouldn't
Summary: FILEOPEN: DOCX: header/footer has text when it shouldn't
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Header-Footer Regressions-ooxml-handle-first-hdr-ftr
  Show dependency treegraph
 
Reported: 2024-01-02 15:59 UTC by Xisco Faulí
Modified: 2024-07-24 14:25 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Comparsion MSO vs LibreOffice 24.8 master (124.86 KB, image/png)
2024-01-02 15:59 UTC, Xisco Faulí
Details
158977_linkNonEmptyFirst.docx: nastier minimal version of comment 0 (19.48 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-07-13 11:38 UTC, Justin L
Details
158977_linkNonEmptyFirst_mso2010.pdf: how comment 9 looks in Word 2010 (90.20 KB, application/pdf)
2024-07-16 11:38 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2024-01-02 15:59:58 UTC
Created attachment 191701 [details]
Comparsion MSO vs LibreOffice 24.8 master

Steps to reproduce:
1. Open attachment 41983 [details] from bug 33072
2. Go to page 2

-> Footer has text

Reproduced in

Version: 24.2.0.0.beta1+ (X86_64) / LibreOffice Community
Build ID: 0034d2ab9382da86340738137218791a4ccc9c90
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: fr-FR (es_ES.UTF-8); UI: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2024-01-02 16:01:39 UTC
Regression introduced by:

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2023-11-28 13:46:21 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	2023-12-01 08:26:38 +0100
commit 4b0fa253a4540f5461397815d290586f9ddabe61 (patch)
tree c58c59871244dc75e538caeea40658303da00b8b
parent 93357349ff1998b41ea1ebedf09dc1cc5da316f7 (diff)
tdf#136472 adjust ooxml import to handle first header/footer

Bisected with: bibisect-linux64-24.2
Comment 2 Xisco Faulí 2024-01-02 17:30:07 UTC
attachment 92600 [details] from bug 59884 is also affected by this issue
Comment 3 Xisco Faulí 2024-02-02 17:16:45 UTC
(In reply to Xisco Faulí from comment #1)
> Regression introduced by:
> 
> author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2023-11-28 13:46:21
> +0900
> committer	Tomaž Vajngerl <quikee@gmail.com>	2023-12-01 08:26:38 +0100
> commit 4b0fa253a4540f5461397815d290586f9ddabe61 (patch)
> tree c58c59871244dc75e538caeea40658303da00b8b
> parent 93357349ff1998b41ea1ebedf09dc1cc5da316f7 (diff)
> tdf#136472 adjust ooxml import to handle first header/footer
> 
> Bisected with: bibisect-linux64-24.2

Hi Tomaz, Miklos,
Looking at the above commit, I see at least 10 tests that were commented out with the comment TODO to make Jenkins happy and be able to submit the patch, which looks like a quite bad practice to me.
Is there any plan from your side to fix those existing tests that were commented out ?
Comment 4 Miklos Vajna 2024-02-05 09:39:57 UTC
https://gerrit.libreoffice.org/c/core/+/162992 restores one of those disabled tests. Once that's in, let's see if the others can be restored in similar ways.
Comment 5 Xisco Faulí 2024-02-05 11:01:03 UTC
(In reply to Miklos Vajna from comment #4)
> https://gerrit.libreoffice.org/c/core/+/162992 restores one of those
> disabled tests. Once that's in, let's see if the others can be restored in
> similar ways.

Thanks a lot for looking into it
Comment 6 Justin L 2024-07-12 21:02:02 UTC
(In reply to Xisco Faulí from comment #2)
> attachment 92600 [details] from bug 59884 is also affected by this issue
"small_example.docx" is a very oddball case. I'd say it is irrelevant.

Note that there is no header/footer content here, but LINE NUMBERING. [In 7.6 if you create a second page, you see the non-first header/footer and it also has LINE NUMBERING on it. So the LINE NUMBERING is not quikee's regression (good in LO 3.6, bad in 4.0). My guess is that MS never numbers the header/footer.]

So the difference from quikee's commit is that before the first page didn't have any header/footer enabled (because it was a separate page style, where the header/footer could be completely turned off), but now it has an empty "different first page" header/footer. Well, the page style's header/footer NEEDS to be enabled for the non-first part. [Implementation detail - not a regression, and not much we can do about it.]
Comment 7 Justin L 2024-07-12 22:10:59 UTC
(In reply to Justin L from comment #6)
((good in LO 3.6, bad in 4.0)
perhaps git log 37b9e290d9e3d20652df0abe1a1458412f3cfe2c..c3aa1cefdc6521d34a2a32c20bae1593e1edb5ba
but I didn't see anything that appeared to fit...
Comment 8 Justin L 2024-07-13 00:28:25 UTC
See https://gerrit.libreoffice.org/c/core/+/170421 as a proposed fix for "DocxWordArtGraphicsSample.docx" mentioned in comment 0.

The key to this bug is that there IS a footer.xml defined for the first section's "first", but it is not used there because the first section doesn't have an active "titlePage", even though it defines it.
Comment 9 Justin L 2024-07-13 11:38:51 UTC
Created attachment 195276 [details]
158977_linkNonEmptyFirst.docx: nastier minimal version of comment 0

(In reply to Justin L from comment #8)
> See https://gerrit.libreoffice.org/c/core/+/170421 as a proposed fix for
> "DocxWordArtGraphicsSample.docx" mentioned in comment 0.
Unfortunately, that is not the right approach...
Comment 10 Commit Notification 2024-07-15 19:47:25 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/aec34ae349aee866db628e7a48cd1b5f6cc6dca1

tdf#158977: restore disable ooxmlimport unit test

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 11 Commit Notification 2024-07-15 19:48:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/626a9e73a0ed8072a5a078dceaf1b4e2ec9ef0d5

tdf#158977: remove obsolete rtfexport testFdo44174

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 12 Commit Notification 2024-07-16 03:27:27 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#158977: restore disabled rtfexport2 testFdo44176

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 13 Justin L 2024-07-16 11:38:53 UTC
Created attachment 195329 [details]
158977_linkNonEmptyFirst_mso2010.pdf: how comment 9 looks in Word 2010

(In reply to Xisco Faulí from comment #3)
> Looking at the above commit, I see at least 10 tests that were commented out
> with the comment TODO to make Jenkins happy and be able to submit the patch
As you can see in comment 10 - 12, I cleaned up a few tests. I commented on Quikee's patch about what I saw, and created bug 162027 which many of them relate to.

Status of the actual bug reported: still open.
DocxWordArtGraphicsSample.docx (in comment 0) is a decent example, but I suggest using comment 9's non-empty-first example.
Comment 14 Justin L 2024-07-16 12:51:54 UTC
This bug is related to bug 159013. In a revert commit there I said:

We can't only copy from the styles that "express" a H/F
(and UNO doesn't let us copy from styles that hide it).

A COPY approach would need to ALWAYS import every header/footer
into a dedicated "header/footer repository" page style,
and every page style would need to copy its "expressed"
headers/footers from the repository to its page style.

That would mean our copy procedure would need to be very robust,