Bug 103261 - FILESAVE: DOCX - Header watermark draw object gets corrupted on roundtripped
Summary: FILESAVE: DOCX - Header watermark draw object gets corrupted on roundtripped
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:5.3.0
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2016-10-16 18:35 UTC by Luke
Modified: 2017-05-18 19:12 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Error message from Word 2013 (4.85 KB, image/png)
2016-10-16 18:39 UTC, Luke
Details
Demo-Hayden-Management.pdf: how the original test looks in MSWord 2003 (217.28 KB, application/pdf)
2016-10-17 09:08 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke 2016-10-16 18:35:44 UTC
Description:
The fix for Bug 89317, 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=b39feae4f12b07a0fdb2c8c2a48d5aae613cd7c9
Corrupt Word 2007 docx files. They cannot be opened in Word 2007 or Word 2013.

Steps to Reproduce:
1. Open attachment 81684 [details] in Writer
2. Save as docx
3. Open in Word 2007 or Word 2013

Actual Results:  
"Word cannot open because it found a problem with <name>.docx because we found a problem with its contents."
/Word/head.xml, Line:2

Expected Results:
Open without error.


Reproducible: Always

User Profile Reset: No

Additional Info:
Files saved by Word 2013 don't seem to have this issue being round-tripped.


User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
Comment 1 Luke 2016-10-16 18:39:10 UTC
Justin or Miklos,
Could you please take a look at this regression caused by the fix for Bug 89317 ?
Comment 2 Luke 2016-10-16 18:39:41 UTC
Created attachment 128033 [details]
Error message from Word 2013
Comment 3 Yousuf Philips (jay) (retired) 2016-10-17 08:47:52 UTC
Confirmed it opened fine in 5.2's export and doesnt in master's.

Version: 5.2.3.0.0+
Build ID: a3218c2737fb3d78989e470991b1c712fc3a4275
CPU Threads: 2; OS Version: Linux 3.19; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:libreoffice-5-2, Time: 2016-09-23_09:38:39
Locale: en-US (en_US.UTF-8); Calc: group

Version: 5.3.0.0.alpha0+
Build ID: 45a7137c6796f33fbf5b8f7cb64e293260d991cb
CPU Threads: 2; OS Version: Linux 3.19; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-10-13_23:38:06
Locale: en-US (en_US.UTF-8); Calc: group

Comparison of the XML between the two and master had the <w:pict> tag in a different location.
Comment 4 Justin L 2016-10-17 09:08:08 UTC
Created attachment 128040 [details]
Demo-Hayden-Management.pdf: how the original test looks in MSWord 2003

Luke, I'm interested to know why you blame that fix.  According to my bibisect, it hasn't worked since LO 4.2. Bibisect-43all says the first bad commit is between this bad commit 6fe1efc01d6f9dc333a74a4e76e554b182651f60
    Author:     Minh Ngo <nlminhtl@gmail.com>
    CommitDate: Sat Sep 14 18:22:22 2013 +0300
    Getting correct media file duration and time.

and good commit 1a412370ab03af8f3865ccbfaaa8dcff1d0ac0ad
    Author:     Siqi LIU <me@siqi.fr>
    CommitDate: Fri Sep 13 08:10:01 2013 +0200
    auto scroll to default time widget fix

I wasn't able to guess which change in that range is the most likely to be the cause and it doesn't appear to have ever been fixed since then.
Comment 5 Justin L 2016-10-17 09:47:47 UTC
(In reply to Yousuf Philips (jay) from comment #3)
> Confirmed it opened fine in 5.2's export and doesn't in master's.

Unable to replicate it working fine in 5.2 with Word 2003. Always fails for me in oldest / newest Linux 5.2 bibisect and anywhere I tested in Linux 5.3 bibisect.
Comment 6 Yousuf Philips (jay) (retired) 2016-10-17 13:12:50 UTC
(In reply to Justin L from comment #5)
> Unable to replicate it working fine in 5.2 with Word 2003. Always fails for
> me in oldest / newest Linux 5.2 bibisect and anywhere I tested in Linux 5.3
> bibisect.

Justin, as the document is a docx, testing it against Word 2003 isnt really applicable. I tested against Word 2010.
Comment 7 Justin L 2016-10-17 16:21:37 UTC
Word2003 with the 2007 compatibility pack handles .docx, so it can be applicable :-)  Tested with Office 2007 and got the same results as 2003. Tested with Office 2013 and it was working until early Thu Oct 13 2016 as Luke said.
Comment 8 Luke 2016-10-17 18:22:15 UTC
(In reply to Justin L from comment #4)
> Created attachment 128040 [details]
> Luke, I'm interested to know why you blame that fix.  According to my
> bibisect, it hasn't worked since LO 4.2. Bibisect-43all says the first bad
> commit is between this bad commit 6fe1efc01d6f9dc333a74a4e76e554b182651f60

With the git bisect command. I initially narrowed the range using builds from 10/13 here:
http://dev-builds.libreoffice.org/daily/master/Win-x86@42/
So I doubt this issue is specific to my build settings.

I think you need either Word 2007, 2010, or 2013 to reproduce this specific issue. JP tested against Word 2010. And I tested both 2007 and 2013. 

Interestingly if I convert the original file to 2013 format. It round trips without errors. Would it help to have a smaller
Comment 9 Luke 2016-10-17 18:22:51 UTC
Would it help to have a smaller test case?
Comment 10 Justin L 2016-10-17 19:10:35 UTC
(In reply to Luke from comment #9)
> Would it help to have a smaller test case?

No, the current one is fine.  Proposed fix https://gerrit.libreoffice.org/#/c/29984/
Comment 11 Justin L 2016-10-19 06:52:46 UTC
Attempted to follow-up on the fact the in MSO2007/2003 it is still corrupt. Used bibisect42max and Office2007 to confirm the corruption mentioned in Comment 7 falls between the range identified in Comment 4.  Unfortunately "Bibisect: This commit covers the following source commit(s) which failed to build..." between Sept 12 and Sept 17, so unable to narrow down the regression to the exact commit.

Reconfirmed that the corruption caused in that range does NOT affect MSO2013. Since 2007 is nearly end of life, it probably isn't worth pursuing this sub-topic further.
Comment 12 Luke 2016-10-19 17:55:32 UTC
Justin L,
Thank you. I verified your patch on gerrit does indeed fix this issue.

I wouldn't worry about 2003 + compatibility pack. Back when my company ran MSO 2003 we experienced forward compatibility issues with native MSO 2007 docs.

If you are interested in improving that test document. The only major issue remaining is with chart import code. The anchoring, wrapping, and position code of the docx chants has never worked correctly. See Bug 82824.
 

The same tags that work for images don't work for charts. It's probably just a matter of re-using or copying some of the image import positioning logic. I tried to fix it a while back but it was beyond my ability.
Comment 13 Commit Notification 2016-10-20 12:35:13 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3ade281c1da91b7646a56227cffba8eb8818ea30

tdf#103261 allow postponed text except in .doc

It will be available in 5.3.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 14 Luke 2016-10-22 18:52:28 UTC
Thanks Justin!

Verified fixed with: Version: 5.3.0.0.alpha1+ (x64)
Build ID: fdd96da1253092317dff68cbc6fb11a7e71834c1

BTW, hadn't had my morning coffee before I posted my last comment. Bug 82824 is the cause of the wrapping issue, but I was confusing it with another existing chart import issue.