Bug 126126 - LibreOffice can't open ODT file with comment created in MS Word
Summary: LibreOffice can't open ODT file with comment created in MS Word
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:7.3.0 target:7.2.2
Keywords: bibisected, filter:odt, regression
Depends on:
Blocks: Comments
  Show dependency treegraph
 
Reported: 2019-06-27 11:16 UTC by leonid.melkozerov
Modified: 2021-08-31 19:03 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
LO can't open this file (9.40 KB, application/vnd.oasis.opendocument.text)
2019-06-27 11:16 UTC, leonid.melkozerov
Details
LO opens this file (5.85 KB, application/vnd.oasis.opendocument.text)
2019-06-27 11:16 UTC, leonid.melkozerov
Details
original DOCX (52.36 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-06-27 11:17 UTC, leonid.melkozerov
Details
File content in MS Word 365 (70.90 KB, image/png)
2019-07-05 10:44 UTC, Inna
Details
Example of bad ODT created in MS Word 2016 (5.76 KB, application/vnd.oasis.opendocument.text)
2019-10-13 20:36 UTC, Roman Kuznetsov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description leonid.melkozerov 2019-06-27 11:16:13 UTC
Created attachment 152441 [details]
LO can't open this file

file exported from MS Word, contains some tables and 1 comment that starts in table and ends after table ("table-with-comment.odt") - LO can't open it (error in context.xml at position 2,84878)

if you remove all tables except first("table-with-comment-other-tables-removed.odt"), LO opens this file, but doesn't load comment end tag
Comment 1 leonid.melkozerov 2019-06-27 11:16:38 UTC
Created attachment 152442 [details]
LO opens this file
Comment 2 leonid.melkozerov 2019-06-27 11:17:03 UTC
Created attachment 152443 [details]
original DOCX
Comment 3 Xisco Faulí 2019-06-27 11:42:31 UTC
Thanks for reporting this issue.
I've downloaded the original DOCX, saved it as ODT and the file is open correctly afterwards

Version: 6.4.0.0.alpha0+
Build ID: a294457eb95e60028539b6783abac78b56561fe2
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

and

Versión: 6.2.4.2
Id. de compilación: 2412653d852ce75f65fbfa83fb7e7b669a126d64
Subprocs. CPU: 1; SO: Windows 6.1; Repres. IU: predet.; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES
Calc: threaded

Please provide a clearer set of step-by-step instructions on how to reproduce the problem.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the steps are provided
Comment 4 leonid.melkozerov 2019-06-27 11:57:18 UTC
try to open exported ODT file, it's attached as first attachment. this file exported by MS Word for macOS 15.26 (160910), and can't be opened by LO 6.2.3 & 6.2.4
Comment 5 Xisco Faulí 2019-06-27 12:19:02 UTC
my question is, how the document was created? I can't replicate it.
Are you able to generate a corrupted file from scratch ?
Comment 6 Inna 2019-07-05 10:44:26 UTC
Created attachment 152575 [details]
File content in MS Word 365
Comment 7 Inna 2019-07-05 10:45:59 UTC
Hello! 
I can provide more detailed info about this issue. Please see file content example in comment above.

Environment: MS Office 365 version 1906 (build 11727.20210), LibreOffice 6.2.3.2; LibreOffice 6.0; Win 7 64 bit

1. Open MS Word 365
2. Insert 3*3 table with text 
3. Add some text after table
4. Ctrl+A
5. Open "Review" tab
6. Click "New comment" button
7. Insert some text in comment body
8. Apply changes for comment
9. Save file as ODT
10. Open File in LibreOffice

Actual result: Error is displayed and it's impossible to open such file.
Comment 8 Roman Kuznetsov 2019-10-13 20:36:43 UTC
Created attachment 154978 [details]
Example of bad ODT created in MS Word 2016
Comment 9 Roman Kuznetsov 2019-10-13 20:39:46 UTC
I can confirm it by steps from Inna with my file from attach. It was created in MS Word 2016

Версия: 6.4.0.0.alpha0+ (x64)
ID сборки: e4979457bf11a4ee4594eb2ba3f9bf9ca07fab79
Потоков ЦП: 4; ОС:Windows 10.0; Отрисовка ИП: GL; VCL: win; 
Локаль: ru-RU (ru_RU); Язык интерфейса: ru-RU
Calc: threaded
Comment 10 Aron Budea 2021-08-09 02:13:44 UTC
This is actually a regression between LO 3.6.0.4 and 4.0.0.3, and could be bibisected to the following range using repo bibisect-43all:
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=06f20d73da21342046a480a6b22af69901351328..51065497ea83e90764860784dc6e193faaf0d673

I wonder if it could be caused by one of the commits related to bug 38244. The main commit there was acaa4d592a0d8cc219f7ec8a65b0c17757a856aa ("fdo#38244 enable attaching comments to document text ranges in writer"), which precedes the above range, but there've been a couple of follow-ups.
Comment 11 Aron Budea 2021-08-09 19:27:39 UTC
Running xmllint on attachment 154978 [details] gives the following result:
./content.xml:120: validity error : xml:id : attribute value 558762200 is not an NCName
ext:p text:style-name="P7"><office:annotation office:name="0" xml:id="558762200"

With a linted and rezipped ODT, LO gives the not particularly helpful pointer to line 165 of content.xml, which is the end of the file.
Comment 12 Miklos Vajna 2021-08-26 09:15:12 UTC
The document has a comment with an anchor which starts in a table cell and finishes outside the the table. Writer doesn't support such selections, and the comment anchor has to be a valid selection.

What used to work in the past is to downgrade the range anchor to a point anchor, let me restore that.
Comment 13 Commit Notification 2021-08-31 07:30:36 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4f4452f6a74201e862971a79ba5bdcd06f3ba9ce

tdf#126126 ODT import: improve import of cross-table commented text range

It will be available in 7.3.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 14 Commit Notification 2021-08-31 19:03:51 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/132e05b43998ecaaf249b851d690fe7239d79c50

tdf#126126 ODT import: improve import of cross-table commented text range

It will be available in 7.2.2.

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.