Issue 127861 - Writer does not show OLE Object inserted from file
Summary: Writer does not show OLE Object inserted from file
Status: RESOLVED FIXED
Alias: None
Product: Writer
Classification: Application
Component: ui (show other issues)
Version: 4.2.0-dev
Hardware: All All
: P5 (lowest) Normal (vote)
Target Milestone: 4.2.0
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: regression
: 128465 (view as issue list)
Depends on:
Blocks:
 
Reported: 2018-08-23 15:10 UTC by Pedro
Modified: 2023-12-30 11:22 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.2.0-dev
Developer Difficulty: ---
knmc: 4.2.0_release_blocker?


Attachments
Small equation document for testing (5.18 KB, application/vnd.oasis.opendocument.formula)
2018-08-23 15:10 UTC, Pedro
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Pedro 2018-08-23 15:10:09 UTC
Created attachment 86493 [details]
Small equation document for testing

This issue occurs on AOO 4.2.0 when inserting any OLE object if the "Link to file" option is not checked.
It was detected on version 4.2.0 build 1838150 and newer on Windows 7 x64 Pro

Steps to reproduce
1) Create new Writer file
2) Insert > Object > OLE Object > Create from file > Search > Select any file (a small sample equation is attached as example)
3) Do _not_ check the "Link to file" option
4) Click OK

Result: an image with a yellow electric plug on top of a document with red text Object 1 shows up

Expected: an image of the inserted object is shown

If the user double clicks on the yellow plug image then the OLE object is opened for editing as expected and after closing the edit window, the correct image is shown.

If the "Link to file" option is checked then the image of the object shows as expected
Comment 1 jmpoo 2018-10-24 10:08:27 UTC
I can confirm this on Linux Mint 18.3 with AOO420m1(Build:9800) - Rev. 1844412

Tried to insert a text file as ole object and get the same error.

Works as expected in AOO416m1(Build:9790) - Rev. 1844227
Comment 2 leva.carol.a 2018-11-30 23:49:01 UTC
I replicated this bug on AOO 4.2 rev 1846059 on a Windows 10 Enterprise desktop for files types TXT, RTF, and PNG.  I could not replicate the bug on prior version AOO 4.1.6 rev 1844436 on a Windows 10 Enterprise desktop for file types TXT, RTF, and PNG.  

I also tried file types OXPS and WMV, and I noticed a different behavior in AAO 4.2, where the generic icon and title show up after (instead of before) double-clicking on the object.  These file types appear as icons in the document instead of showing their content in the document.  Initially, an appropriate icon and title is shown in the document, but after you double-click on the icon and open the file, it changes to the plug-in icon with a generic Object title.

Steps to replicate:
1) Open a new Writer document
2) From the menu, select Insert>Object>OLE Object
3) From the “Insert OLE Object” dialog, select “Create from File”, then use the Search button to select a file with a WMV extension.  Make sure “Link to file” is not checked and select OK.
4) Note that an appropriate icon and title appears on the object.
5) Double-click on the object, then select Open from the “Open Package Contents” dialog.  The WMV file opens in a video player app.  Close this app.
6) Note that the object icon has changed to a plug-in icon and the title has changed to Object 1.

Actual Result: Icon and title on object are changed to a generic icon and title
Expected Result: Appropriate icon and title on object are retained

Additional information: This behavior does not occur when using the “Link to file” option for a WMV file.  This behavior also occurs in AOO 4.1.6 for a WMV file.
Comment 3 Keith N. McKenna 2018-12-01 01:01:00 UTC
Confirmed by Comments 1 & 2.

jmpoo and leva.carol.a please consider joining the QA team. For more information see the QA orientation page at https://openoffice.apache.org/orientation/intro-qa.html
Comment 4 Keith N. McKenna 2020-10-13 21:59:40 UTC
I have replicated this in AOO 4.2.0-Dev2 and as it is a regression, it works in AOO RC2 I believe it should be a release blocker.
Comment 5 Czesław Wolański 2021-10-23 10:23:22 UTC
Issue 128465
"Inserting a Formula Directly - formula not shown immediately"
describes similar symptoms.
Comment 6 damjan 2023-10-01 19:02:19 UTC
The equation does show immediately after insertion in 2ed47956e3ec22116d5164494008afeac3f699a1 on Windows from 29 August 2015.

If it's broken on SVN commit 1838150, which is git commit 816b35f85d2528a06b83fb2832c4d1eb52b6fe62 on 16 August 2018, then the regression happened somewhere between those commits.

1069 commits to bisect...
Comment 7 damjan 2023-10-03 15:56:52 UTC
The regression happened somewhere between these 134 commits between:
e74cb447ea3816bfc4b366ebc4fba3b638e9c65a (5 August 2017)
and
db54ab87120ff0d8e8b488a3aea635318583b1f4 (2 December 2017)

I have a grim suspicion that it was caused by one of the backports of security patches from 4.1.X that affect embedded objects, but let's still see what further bisects reveal. If true, a longer audit of 4.1.X might be needed to find why it didn't cause a regression there too.
Comment 8 damjan 2023-10-03 18:37:52 UTC
Finally found the regression:

---snip---
eab2447c44324e4faff5275517dba43fafb93341 is the first bad commit
commit eab2447c44324e4faff5275517dba43fafb93341
Author: Jim Jagielski <jim@apache.org>
Date:   Wed Aug 16 20:13:07 2017 +0000

    Align w/ AOO414 on these fixes
    
    git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1805237 13f79535-47bb-0310-9956-ffa450edef68

 .../source/container/embeddedobjectcontainer.cxx     |  6 +++---
 main/filter/source/msfilter/svdfppt.cxx              |  5 +++++
 main/sfx2/source/appl/linkmgr2.cxx                   | 20 ++++++++++----------
 main/svtools/source/misc/embedhlp.cxx                |  2 +-
 main/sw/source/filter/ww8/ww8par2.cxx                | 10 +++++-----
 5 files changed, 24 insertions(+), 19 deletions(-)
---snip---




Jim: any ideas? What was this commit meant to accomplish, and how did it cause this regression in 4.2.x but not in 4.1.x?
Comment 10 damjan 2023-10-07 18:28:36 UTC
(In reply to Matthias Seidel from comment #9)
> Maybe it should align with:
> 
> https://github.com/apache/openoffice/commit/
> cf914f842e0d4f6546c2c6edefa5660411c62b42
> 
> and
> 
> https://github.com/apache/openoffice/commit/
> 611fcdab0900c77ff92ad579f9da6d63d2aca818
> 
> ?
> 
> Am I wrong or are there parts missing?

If we look at the files changed by the bad commit eab2447c44324e4faff5275517dba43fafb93341, and do a:

$ git diff -w AOO41X..trunk PATH/TO/FILE

for all the files changed by that commit, they are all the same (barring comment changes), except for this one:

---snip---
$ git diff -w AOO41X..trunk main/svtools/source/misc/embedhlp.cxx
diff --git a/main/svtools/source/misc/embedhlp.cxx b/main/svtools/source/misc/embedhlp.cxx
index c08bb364ba..c82a8f9fa8 100644
--- a/main/svtools/source/misc/embedhlp.cxx
+++ b/main/svtools/source/misc/embedhlp.cxx
@@ -709,7 +709,7 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( sal_Bool bUpdate ) const
     if ( !xStream.is() )
     {
                RTL_LOGFILE_CONTEXT_TRACE( aLog, "getting stream from object" );
-        bool bUserAllowsLinkUpdate(true);
+        bool bUserAllowsLinkUpdate(false);
         const comphelper::EmbeddedObjectContainer* pContainer = GetContainer();
 
         if(pContainer)
---snip---

Now if on trunk I change that "false" to "true" like in AOO41X, it fixes this bug - the equation shows when inserted.

But how did bUserAllowsLinkUpdate become "false" in the first place?

It was originally "true", and commit eab2447c44324e4faff5275517dba43fafb93341 changed it to "false" on trunk but NOT on AOO41X!!! AOO41X remained on "true" from 2014 till present day!!!

Why?
- Was the change to false made on the wrong variable, or wrong file?
- Was it meant to be false on AOO41X too but never set to false?
- What was the point of these patches in the first place? They look related to some security fix. If so, is AOO41X still vulnerable?
Comment 11 damjan 2023-10-08 16:56:41 UTC
The changelog for main/svtools/source/misc/embedhlp.cxx, shows the:

---snip---
        bool bUserAllowsLinkUpdate(true);
---snip---

came from 963c6022f24579e0f2f001621d7d3631970d71c3 in 2014 for bug 125386, and appears to have fixed that bug, so it should be true (instead of false) in trunk as well.

---snip---
commit dc7ddb711f16837106137e3e2a512e9200048da7 (HEAD -> trunk)
Author: Damjan Jovanovic <damjan@apache.org>
Date:   Sun Oct 8 18:51:45 2023 +0200

    The bUserAllowsLinkUpdate variable was erroneously changed to false
    in commit eab2447c44324e4faff5275517dba43fafb93341, causing formulas inserted
    without linking to the file to not display until double-clicked on.
    Change that variable to true like it always was in the AOO41X branch.
    
    Patch by: me
    Found by: Pedro Lino
---snip---

Resolving FIXED. Thank you for your bug report!
Comment 12 damjan 2023-10-08 16:59:10 UTC
Cherry picked for AOO42X in commit 405ea29d30eefeab1cbcdbada03548845d83dbca.
Comment 13 damjan 2023-12-30 11:22:40 UTC
*** Issue 128465 has been marked as a duplicate of this issue. ***