Bug 110987

Summary: Binary MS Office files identified as template when they're opened lacking file extension or with "wrong" file extension
Product: LibreOffice Reporter: Aron Budea <aron.budea>
Component: filters and storageAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: tml, xiscofauli
Priority: low Keywords: bibisected, bisected, regression
Version: 4.1.0.4 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=119530
https://bugs.documentfoundation.org/show_bug.cgi?id=125216
https://bugs.documentfoundation.org/show_bug.cgi?id=129944
Whiteboard: target:6.3.0 target:6.2.2
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104848, 123475    

Description Aron Budea 2017-08-01 13:13:16 UTC
- Save a document in DOC format(can be empty).
- Rename file and remove .doc extension.
- Open file in LO.

=> Title says "Untitled 1", presumably because the file is identified as a .dot template.
I understand there's a complex identification process for files not having extensions as clues, and I'm not sure if DOC and DOT files can be told apart, but since documents are more common than templates, such a file should be identified as DOC.

Observed with LO 5.4.0.3 / Windows 7 & Ubuntu 17.04.
If file is opened from start center, 4.0.0.3 is fine, 4.1.0.4 is not.
If file is opened from Writer, 3.5.0.3 is fine, 3.6.0.4 is not.
=> regression in both cases.
Comment 1 Aron Budea 2017-08-01 14:09:00 UTC Comment hidden (bibisection)
Comment 2 Aron Budea 2017-08-01 14:13:15 UTC
One of these:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=1a3c7b84b7b22109d691a770649af42c1033d709
author		Kohei Yoshida <kohei.yoshida@gmail.com>	2013-03-06 07:00:02 (GMT)
committer	Kohei Yoshida <kohei.yoshida@gmail.com>	2013-03-07 06:44:45 (GMT)
Test all file format types regardless of document services.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=c9fbcaa0b97c31216f5da8febd066a029c9bdef2
author		Kohei Yoshida <kohei.yoshida@gmail.com>	2013-03-06 21:27:23 (GMT)
committer	Kohei Yoshida <kohei.yoshida@gmail.com>	2013-03-07 06:44:46 (GMT)

Reject type detection for zip formats when the stream is not a zip archive.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=96c8251448646b65f6ea0b657417bca66d9a9b6e
author		Kohei Yoshida <kohei.yoshida@gmail.com>	2013-03-07 05:28:00 (GMT)
committer	Kohei Yoshida <kohei.yoshida@gmail.com>	2013-03-07 06:44:46 (GMT)

fdo#60562: List *all* format types that we support and rank them all properly.
Comment 3 Aron Budea 2017-08-02 01:34:03 UTC
Binary Excel and PowerPoint formats are also affected.
Comment 4 Xisco FaulĂ­ 2017-11-02 08:46:11 UTC Comment hidden (obsolete)
Comment 5 Commit Notification 2018-07-13 16:26:37 UTC Comment hidden (obsolete)
Comment 6 Aron Budea 2018-08-03 01:12:26 UTC Comment hidden (obsolete)
Comment 7 Commit Notification 2018-09-08 18:11:44 UTC Comment hidden (obsolete)
Comment 8 Aron Budea 2018-09-08 19:20:39 UTC
The commit in comment 5 caused a regression, no idea why, it doesn't seem to be diretly related, but perhaps for embedded documents them opening as template mattered.
Comment 9 Aron Budea 2019-02-18 15:16:27 UTC
*** Bug 123545 has been marked as a duplicate of this bug. ***
Comment 10 How can I remove my account? 2019-02-18 15:41:47 UTC
This bug fires also when a .doc file has been renamed to have another extension, at least .rtf.
Comment 11 Commit Notification 2019-02-19 17:03:13 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

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

tdf#110987: Don't mis-detect .doc files as .dot

It will be available in 6.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 12 Commit Notification 2019-02-20 16:27:53 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

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

tdf#110987: Don't mis-detect .doc files as .dot

It will be available in 6.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.
Comment 13 Aron Budea 2019-03-04 12:46:50 UTC
Let's consider this fixed, thanks Tor!
Comment 14 How can I remove my account? 2019-04-08 09:35:32 UTC
Probably should file separate bugs for the Excel and Powerpoint cases from comment #3. Aron?