Bug 108954 - FILESAVE: DOCX: new line added every roundtrip
Summary: FILESAVE: DOCX: new line added every roundtrip
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.2.0
Keywords: bibisected, bisected, filter:docx, regression
: 105154 (view as bug list)
Depends on:
Blocks: DOCX
  Show dependency treegraph
 
Reported: 2017-07-04 18:37 UTC by Xisco Faulí
Modified: 2018-12-21 14:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
tdf108954_RTaddsSection.docx: homemade, minimal unit test (4.71 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-11-08 13:16 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2017-07-04 18:37:42 UTC
Steps:
1. Open attachment 59921 [details] from bug 48658
2. Save it as DOCX
3. Open the new file

Observed behaviour: A new line has been added to the end


[Bug found by office-interoperability-tools]

Reproduced in

Version: 6.0.0.0.alpha0+
Build ID: cb37c5f0f3de7b545231a53d46a5271058af76ad
CPU threads: 1; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-06-23_06:55:41
Locale: es-ES (es_ES); Calc: group
Comment 1 Xisco Faulí 2017-07-04 18:38:49 UTC
Regression introduced by:

author	Miklos Vajna <vmiklos@collabora.co.uk>	2017-06-13 07:05:06 (GMT)
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-06-13 09:30:43 (GMT)
commit 2a73e7d88c19cab69733a4f6433d8576856285ac (patch)
tree d448994c4d8877a8cddccc7d4302bb3797b97264
parent 16265a1f84f0ac7c16beee6a3591653eaaa90323 (diff)
tdf#107618 DOCX export: fix missing header when doc ends with section
See commit b6e62dc0dc2b284c825f1182a67bb2f9259a30ce (tdf#106492 DOCX
export: fix duplicated section break at doc end, 2017-03-21) for the
context, this is one more case where it's not OK to suppress the two
section breaks at the end of a document, since the suppressed section
break is the one that provides the headers / footers.

Bisected with bibisect-linux64-6.0

Adding Cc: to Miklos Vajna
Comment 2 Justin L 2017-11-08 13:16:58 UTC
Created attachment 137617 [details]
tdf108954_RTaddsSection.docx: homemade, minimal unit test

The problem comes because bEmit is now true after
+  bEmit = rMaster.GetHeader().IsActive() || rMaster.GetFooter().IsActive();

The fix for bug 107618 was backported to 5.4.

My first impression is that this is mostly an unfixable problem, related more to the difference between continuous sections/page styles in LO vs MSO, than to section endings. I need to look at the earlier bug 106492 for a better understanding, but my gut feeling is that this just needs to be reverted.
Comment 3 Justin L 2017-11-08 18:41:59 UTC
The unit test from bug 107618 also grows by one section each RT!!!

Interestingly, old Word 2003 also has trouble saving tdf107618.doc as .docx format, loosing one section and one header.
Comment 4 Justin L 2018-10-27 14:27:41 UTC
*** Bug 105154 has been marked as a duplicate of this bug. ***
Comment 5 Justin L 2018-10-27 15:39:57 UTC
proposed fix at https://gerrit.libreoffice.org/62430
Comment 6 Commit Notification 2018-10-29 03:33:49 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/cb7500ddb8de6c41fca84a0009ffe22240bb1845%5E%21

tdf#108954 docxexport: only emit section if diff from current

It will be available in 6.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 7 Xisco Faulí 2018-11-20 10:44:47 UTC
Verified in

Version: 6.2.0.0.beta1+
Build ID: c13f4d0a2ff503cdebbc789e1711f90e7b5fe379
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 8 Justin L 2018-12-21 14:38:00 UTC
This caused a regression logged as bug 121374, which has been fixed, so marking this one as fixed/verified now.