Bug 158442 - LibreOffice application no longer opens hybrid PDFs in the correct application
Summary: LibreOffice application no longer opens hybrid PDFs in the correct application
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.6.3.2 release
Hardware: All All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:7.6.5
Keywords: bibisected, bisected, regression
: 158579 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-11-29 17:04 UTC by Alois Klotz
Modified: 2024-01-01 22:28 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
This file is a PDF with embedded Writer file. (43.31 KB, application/pdf)
2023-11-29 17:08 UTC, Alois Klotz
Details
Message opening with Ver 24.2 (created with 7.6.3 oe 24.2) (77.64 KB, image/png)
2023-11-29 17:30 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alois Klotz 2023-11-29 17:04:29 UTC
Description:
Hybrid PDFs now only open with Draw.

Steps to Reproduce:
1.Create a writer file. 
2.Export this Writer file as a Hybrid PDF (embedded ODF file)
3.Open this Hybrid PDF with LibreOffice

Actual Results:
LibreOffice opens the Hybrid PDF with Draw

Expected Results:
LibreOffice should open the Hybrid PDF with Writer


Reproducible: Always


User Profile Reset: Yes

Additional Info:
The hybrid PDFs generated in LibreOffice 7.6.3.2 are not the issue — they open correct with LibreOffice 7.6.2.1
Comment 1 Alois Klotz 2023-11-29 17:08:13 UTC
Created attachment 191116 [details]
This file is a PDF with embedded Writer file.

The file should be opened with Writer
Comment 2 m_a_riosv 2023-11-29 17:30:25 UTC
Created attachment 191117 [details]
Message opening with Ver 24.2 (created with 7.6.3 oe 24.2)

Seems the inserted file in the pdf is corrupted, so only the pdf is open on Draw.
Reproducible.
Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 01a02ee7f1dbe7501a89b41e62599fba6a8b33f3
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded
Comment 3 m_a_riosv 2023-11-29 17:30:58 UTC
Regression from
Version: 7.5.9.1 (X86_64) / LibreOffice Community
Build ID: 2f04f73a0f4ebfe9735ca11da23d6ed8f830fe34
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: default; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded
Comment 4 m_a_riosv 2023-11-29 17:32:45 UTC
Set as critical because embedded file, it's lost.
Comment 5 BogdanB 2023-11-29 20:26:16 UTC
I tried to bibisect, but is always good with 7.6 or 24.2. But also I can reproduce with 7.6 build by myself, not from bibisect repository.

Also don't repro with
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded

Strange, that I can reproduce with latest 24.2
Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: c8f7408db73d2f2ccacb25a2b4fef8dfebdfc6cb
CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 6 BogdanB 2023-11-29 20:27:10 UTC
"But also I can reproduce with 7.6 build by myself, not from bibisect repository". --> an typo here --> "But also I can reproduce with 24.2 build by myself, not from bibisect repository."
Comment 7 m_a_riosv 2023-11-29 22:25:56 UTC
Some work on detect hybrid in

https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=hybrid
2023-01-25	tdf#66580 added hybrid PDF test cases	Tomaž Vajngerl	
2023-01-24	tdf#66580 write ODF document as an attachment in hybrid mode	Tomaž Vajngerl	
2023-01-24	pdfimport: refactor pdf and hybrid format detection code	Tomaž Vajngerl
Comment 8 V Stuart Foote 2023-11-30 04:13:29 UTC
(In reply to m.a.riosv from comment #7)

Maybe, but quikee's work on the detection went in Jan of 2023, so would already be in 7.6.2 which looks to have no issues with hybrid PDF detection. Would be something much more recent.  The bibisect is needed...
Comment 9 raal 2023-11-30 18:18:00 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-24.2.
Adding Cc: to Mike Kaganski ; Could you possibly take a look at this one?
Thanks
 932af46865b12a166ecc444cfb1da8caeb2f56cf is the first bad commit
commit 932af46865b12a166ecc444cfb1da8caeb2f56cf
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Sun Nov 26 21:18:43 2023 +0100

    source 86c682273d907c77404637c89e584047de1c1099

159976: tdf#96401: allow to detect a broken ZIP package | https://gerrit.libreoffice.org/c/core/+/159976
Comment 10 Mike Kaganski 2023-11-30 20:27:15 UTC
(In reply to raal from comment #9)

This can't be correct.
Attachment 191116 [details] opens in Writer using 7.6.3.2; also creating a new hybrid PDF in Writer 7.6.3.2 creates a PDF that again opens in Draw. 7.6.3.2 (built 2023-11-18, announced 2023-11-23) doesn't include commit 86c682273d907c77404637c89e584047de1c1099 from 2023-11-26 (last Sunday).
Comment 11 Mike Kaganski 2023-11-30 20:40:27 UTC
In fact, it's a regression after my 046e9545956d8ad1d69345d6b4a4c0a33714d179 :-D
Comment 12 Mike Kaganski 2023-11-30 20:45:09 UTC
... but that was Windows-only change, making Windows work as Linux; a bibisect on Linux could give some even older result...
Comment 13 raal 2023-12-01 06:32:50 UTC
(In reply to Mike Kaganski from comment #12)
> ... but that was Windows-only change, making Windows work as Linux; a
> bibisect on Linux could give some even older result...

I checked the results with git checkout bisected_commit and git checkout HEAD~1
Comment 14 Mike Kaganski 2023-12-01 06:35:12 UTC
(In reply to Mike Kaganski from comment #10)
> Attachment 191116 [details] opens in Writer using 7.6.3.2

Oh, I must re-read what I write.
It was meant to say "Attachment 191116 [details] opens in *Draw* using 7.6.3.2"

Tested using
Version: 7.6.3.2 (X86_64) / LibreOffice Community
Build ID: 29d686fea9f6705b262d369fede658f824154cc0
CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL threaded
Comment 15 Mike Kaganski 2023-12-01 08:45:32 UTC
Sigh.
The problematic commit, that prevents working on Windows after my 046e9545956d8ad1d69345d6b4a4c0a33714d179, is -
ironically - 2b4cd99d3360ccffb9829a02412824864d045753, intended to "make Windows file handling more unx-like". It makes default file locking share mode FILE_SHARE_READ | FILE_SHARE_WRITE, and that conflicts with boost's mmap_file_iterator (used in file_iterator), which needs FILE_SHARE_READ [1]. Sigh again.

[1] https://github.com/boostorg/spirit/blob/59515f0e56aebdf958eadab30be99cac8872e723/include/boost/spirit/home/classic/iterator/impl/file_iterator.ipp#L183
Comment 16 Mike Kaganski 2023-12-01 08:55:19 UTC
(In reply to raal from comment #13)

Heh, it's *likely* two issues together (however unlikely such constellation might seem): something on Linux, and something *else* on Windows (with different reasons, different starting points, but both related to my - different - changes).

Please make sure you test with commit c36cba38cc33f22e3388968814f426e88b7f1cd8 (from Nov 28) and commit 93357349ff1998b41ea1ebedf09dc1cc5da316f7 (from today).
Comment 17 Commit Notification 2023-12-01 15:13:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#158442: fix opening hybrid PDFs on Windows

It will be available in 24.2.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 18 Mike Kaganski 2023-12-01 15:16:13 UTC
Let me close it fixed. The introduced unit test makes sure that hybrid PDFs open in respective components on *all* platforms. But if there's still some scenario where it fails, please file it separately. Thank you!
Comment 19 raal 2023-12-01 16:07:06 UTC
(In reply to Mike Kaganski from comment #16)
> (In reply to raal from comment #13)
> 
> Heh, it's *likely* two issues together (however unlikely such constellation
> might seem): something on Linux, and something *else* on Windows (with
> different reasons, different starting points, but both related to my -
> different - changes).
> 
> Please make sure you test with commit
> c36cba38cc33f22e3388968814f426e88b7f1cd8 (from Nov 28) and commit
> 93357349ff1998b41ea1ebedf09dc1cc5da316f7 (from today).

Verified with Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 55097433ed766a2ced6b87021a71c8a31cde9d99
CPU threads: 4; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

Thanks for the fix.
Comment 20 BogdanB 2023-12-01 16:09:41 UTC
Mike, is a solution also for Linux? It seems I could reproduce on 24.2alpha
Comment 21 Mike Kaganski 2023-12-01 16:15:06 UTC
(In reply to BogdanB from comment #20)

As I wrote, it is expected that it works on *all* platforms.
1. What specifically do you see, that makes you unsure ("It seems I could...")?
2. With which specific version (which last commit) did you test?

As said: if you still repro, with all the changes mentioned in this bug, please file it separately, and CC me.
Thanks!
Comment 22 BogdanB 2023-12-01 20:33:53 UTC
Working well also on master on Linux, thanks, Mike.

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 08ba31da63b58e92de05e96563146d3e909352e9
CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 23 Mike Kaganski 2023-12-07 16:47:15 UTC
*** Bug 158579 has been marked as a duplicate of this bug. ***
Comment 24 grofaty 2023-12-07 16:59:30 UTC
@Mike Kaganski, can you please consider creating fix for 7.6.x branch too?
Comment 25 Mike Kaganski 2023-12-07 17:04:44 UTC
(In reply to grofaty from comment #24)

It is already there, in https://gerrit.libreoffice.org/c/core/+/160306, waiting for independent review.
Comment 26 Commit Notification 2024-01-01 22:28:29 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/873c56df149bb463e5267162e43c755ad16779b8

tdf#158442: fix opening hybrid PDFs on Windows

It will be available in 7.6.5.

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.