Bug 102479 - FILESAVE: a DOCX document with a shape/frame that contains nothing but a table cannot be saved as ODT
Summary: FILESAVE: a DOCX document with a shape/frame that contains nothing but a tabl...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: high critical
Assignee: Not Assigned
URL:
Whiteboard: interoperability odf target:5.4.0 tar...
Keywords: dataLoss, filter:docx
Depends on:
Blocks:
 
Reported: 2016-09-23 22:36 UTC by Aron Budea
Modified: 2022-09-21 08:08 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2016-09-23 22:36:14 UTC
This is a follow-up to bug 99273. Original report was about the following attachment not being able to be saved (as DOCX):
https://bugs.documentfoundation.org/attachment.cgi?id=124308

File actually can't be saved as ODT.

Error text:
"Error saving the document Especificacion- Requerimientos-v1:
Write Error.
Error in writing sub-document styles.xml."

File can be saved as ODT in 4.3.0.4, but the original DOCX is incompletely loaded (only first page is loaded), so it's not really a regression.

Bug is likely related to (or same as) bug 102466, and the issue probably started with the commit mentioned there, but I haven't tested.

Also, a couple of other bug reports have this same error message (bug 101858 and bug 100819), it would be great to know what the underlying problem is when it's displayed.
Comment 1 Aron Budea 2016-09-23 22:40:01 UTC
Setting to NEW based on bug 99273.
Comment 2 Miklos Vajna 2016-11-21 08:13:53 UTC
Yes, older LO versions silently stopped importing a document when an exception happened, newer ones report that error properly.

Regarding save, that just means somewhere during the write of styles.xml (probably in xmloff) an exception happened.

If you use a dbgutil build, you probably get more information about where that exactly happened. It's quite possible that the root cause of these bugs is different, so probably it's a good idea to not mark them as duplicate right now.
Comment 3 Michael Stahl (allotropia) 2016-11-25 22:07:32 UTC
SwXTextFrame::createTextCursor() throws because it's on node 34:

[ 34] 0x429e920 StartNode , 
[ 35] 0x429eb90 GrfNode , 
[ 36] 0x4352240 EndNode , 

clearly that is not a text frame?

ah the format actually points to node 8 but then the cursor runs over into the next frame since there is nothing but a table in here:

[ 8] 0x44e5400 StartNode , 
[ 9] 0x45f1ef0 TableNode , 
[ 10] 0x43950f0 StartNode , 
[ 11] 0x44e4970 TextNode "", 
[ 12] 0x44d5130 TextNode "Especificación Requerimientos del Cliente", 
[ 13] 0x44d5a50 TextNode "", 
[ 14] 0x45f3240 TextNode "", 
[ 15] 0x45f39b0 TextNode "Migración SREM desde mysql a sql server ", 
[ 16] 0x45f3ac0 TextNode " ", 
[ 17] 0x45f2be0 TextNode "", 
[ 18] 0x45f1940 TextNode "", 
[ 19] 0x45f1f80 EndNode , 
[ 20] 0x462cca0 StartNode , 
[ 21] 0x45f34e0 TextNode "\001", 
[ 22] 0x4361910 TextNode "", 
[ 23] 0x42a6330 TextNode " ", 
[ 24] 0x43b2b10 TextNode "", 
[ 25] 0x45f1fc0 EndNode , 
[ 26] 0x45f3420 StartNode , 
[ 27] 0x45f60f0 TextNode "Este documento, incluyendo la información contenida en él, es restringido, confidencial y de propiedad de Netweb Ingenieria de Sistemas Ltda. (Serviweb), y no puede ser utilizado o reproducido, para ningún propósito, sin el consentimiento escrito de Serviweb.", 
[ 28] 0x45f3470 EndNode , 
[ 29] 0x45f6470 StartNode , 
[ 30] 0x4310fa0 TextNode "Preparado por: Serviweb.", 
[ 31] 0x45f64c0 EndNode , 
[ 32] 0x42907d0 EndNode , 
[ 33] 0x44e5450 EndNode , 

... the problem is essentially that for a text frame with only a table SwXTextFrame::createTextCursor() explicitly throws an exception, in
contrast to SwXBodyText::createTextCursor() which would just start on the
table node in this case.

apparently the createTextCursor call in the ODF export happens only in the
special case where the shape SwXShape has an aggregated SwXTextFrame;
a plain SwXTextFrame with just a table can be exported.

it's not obvious to me why we need to throw an exception if there is only a table - this was added with:

commit 65bd995e095460faccfc10cf5b1d97809ae7ec8a
Author:     Oliver Specht <os@openoffice.org>
AuthorDate: Thu Nov 15 14:48:44 2001 +0000

    #94705# take care for tables and sections in headers/footers/text frames

commit ddf10fd1f85f24ae6a6e587a0fe11b4812ee66f3
Author:     Oliver Specht <os@openoffice.org>
AuthorDate: Wed Nov 8 13:56:39 2000 +0000

    #80121# createTextCursor in frames: skip tables

... i've gone ahead based on the assumption that the exception
is intentional and submitted https://gerrit.libreoffice.org/#/c/31218/
Comment 4 Commit Notification 2016-11-29 15:23:42 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7661bbbaef31adfdb298b1447301b24a70f85834

tdf#102479 ODF export: ignore exceptions when checking shape text

It will be available in 5.4.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 5 Commit Notification 2016-11-30 10:36:16 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=de62a3ec928fb871ca8165a9349862778c2f3f1b&h=libreoffice-5-3

tdf#102479 ODF export: ignore exceptions when checking shape text

It will be available in 5.3.0.1.

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 6 Commit Notification 2016-12-05 09:15:37 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e1dcbd0f7f6bacafcbdb6e74d29af2151120bc6f&h=libreoffice-5-2

tdf#102479 ODF export: ignore exceptions when checking shape text

It will be available in 5.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 7 Michael Stahl (allotropia) 2016-12-05 10:50:50 UTC
ok let's call it fixed then