Bug 158388 - Files with corrupted meta.xml should be able to open and rebuild since it's not a fatal error
Summary: Files with corrupted meta.xml should be able to open and rebuild since it's n...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.3 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.8.0
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-27 05:26 UTC by Dev
Modified: 2024-01-16 17:23 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
ODF file with corrupted meta.xml (3.97 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-11-27 05:26 UTC, Dev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dev 2023-11-27 05:26:36 UTC
Created attachment 191051 [details]
ODF file with corrupted meta.xml

The attached file couldn't be opened because the meta.xml is empty.  This is an issue reported by our local users.

However,

1. It can be opened by earlier version, 4.0.6.2 or 3.6.7.2.
2. We found that in sc/source/ui/docshell/docsh.cxx, when parsing the meta.xml, it is NOT a "must be successful" step.  So we tried to make it pass and give a warning to users to save as a new file to restore the meta data.

See also: https://gerrit.libreoffice.org/c/core/+/156574
Comment 1 Mike Kaganski 2023-11-27 06:46:14 UTC
See also: https://gerrit.libreoffice.org/c/core/+/159976

Since this is a broken package, the fix should set the RepairPackage media descriptor property to true, after a prompt.

In package/source/zippackage/ZipPackage.cxx, there are checks related to the most fundamental things - e.g., for ODF packages, manifest is checked.

But all the other XML streams can't be checked there; so the XML parser needs to do the job.
Comment 2 Dev 2023-11-29 03:31:58 UTC
(In reply to Mike Kaganski from comment #1)
> See also: https://gerrit.libreoffice.org/c/core/+/159976
> 
> Since this is a broken package, the fix should set the RepairPackage media
> descriptor property to true, after a prompt.
> 
> In package/source/zippackage/ZipPackage.cxx, there are checks related to the
> most fundamental things - e.g., for ODF packages, manifest is checked.
> 
> But all the other XML streams can't be checked there; so the XML parser
> needs to do the job.

Not sure if it is related to broken zip or not.  In our case the ods file itself is zipped-okay, we could unzip it (so that we knew the meta.xml was wrong).  No idea why meta.xml was emptied (since this file is from our user).

Indeed it should be solved in more general way, not specific to Calc.  However so far when we tried to search where to process/import meta.xml it was spread in different components like sc/, sd/, sw/, etc.  Do you suggest us to add similar code to all those components, or is there another "upper" place to handle this at once?
Comment 3 Dev 2023-12-05 06:50:34 UTC
(In reply to Dev from comment #2)
> (In reply to Mike Kaganski from comment #1)
> > See also: https://gerrit.libreoffice.org/c/core/+/159976
> > 
> > Since this is a broken package, the fix should set the RepairPackage media
> > descriptor property to true, after a prompt.
> > 
> > In package/source/zippackage/ZipPackage.cxx, there are checks related to the
> > most fundamental things - e.g., for ODF packages, manifest is checked.
> > 
> > But all the other XML streams can't be checked there; so the XML parser
> > needs to do the job.
> 
> Not sure if it is related to broken zip or not.  In our case the ods file
> itself is zipped-okay, we could unzip it (so that we knew the meta.xml was
> wrong).  No idea why meta.xml was emptied (since this file is from our user).
> 
> Indeed it should be solved in more general way, not specific to Calc. 
> However so far when we tried to search where to process/import meta.xml it
> was spread in different components like sc/, sd/, sw/, etc.  Do you suggest
> us to add similar code to all those components, or is there another "upper"
> place to handle this at once?

Actually we found that for Writer (sw) and Impress/Draw (sd) they've been taken care of.  LibreOffice will give a warning, but still open odt/odp with corrupted meta.xml.  Only Calc has this problem.
Comment 4 Commit Notification 2023-12-12 09:48:30 UTC
Lodev committed a patch related to this issue.
It has been pushed to "master":

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

tdf#158388 Allow user to open ODS file with corrupted meta.xml & settings.xml

It will be available in 24.8.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 5 Buovjaga 2024-01-16 17:23:31 UTC
Should this report be closed as fixed?