Bug 120736 - Automatic update of external links in shared spreadsheet is disabled even though file is in trusted location and setting for opening is "Always" (see comment 13)
Summary: Automatic update of external links in shared spreadsheet is disabled even tho...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.0.3 release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Stephan Bergmann
URL:
Whiteboard: target:6.3.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Calc-External-Datalink
  Show dependency treegraph
 
Reported: 2018-10-20 17:45 UTC by Edmund Laugasson
Modified: 2019-02-26 21:38 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
two test files and GDBtrace (8.61 KB, text/x-log)
2019-02-18 22:06 UTC, Rich
Details
1 test file (7.50 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-02-18 22:08 UTC, Rich
Details
2nd test file (8.05 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-02-18 22:09 UTC, Rich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Edmund Laugasson 2018-10-20 17:45:38 UTC
Description:
This bug concerns about having external linked data and shared mode.

Steps to Reproduce:
1. create an .ods document in Calc
2. add name to cell blocks (https://help.libreoffice.org/Calc/Naming_Cells)
3. add new sheet
4. link named cell block as external data to new sheet (https://help.libreoffice.org/Calc/Link_to_External_Data)
5. save document
6. share the document (Tools->Share spreadsheet) and save it
7. try to open the document in another computer over shared folder, I used Virtualbox 5.2.20 (extension pack + guest additions installed) shared folder
8. there will be a warning message "Automatic update of external links has been disabled" in both side and an option to click the button "Enable Content" - I clicked that in both side
9. After opening same shared document in two different locations: one locally, another over network - at some point the LibreOffice will start using CPU close to maximum (96...98%) and will crash - window keeps open but not responsive and trying to interact with that, system asks that this does not respond, would I like to close that using force. So I will close it with force.

Actual Results:
There is a warning "Automatic update of external links has been disabled" when opening file with linked data in shared mode. LibreOffice Calc will start consuming CPU intensively and will finally crash.

Expected Results:
LibreOffice Calc will not crash. If external linked data is not supported while shared mode enabled then either external data linking should be forcibly turned off with appropriate warning or not allow to use shared mode while external data linking is active. If supports then such warning should not be displayed and data linking should work as promised.


Reproducible: Always


User Profile Reset: No



Additional Info:
Used 64-bit AppImage version of LibreOffice in Linux Mint 19 MATE (both: host and guest in terms of VirtualBox)
Comment 1 Edmund Laugasson 2018-10-20 17:48:06 UTC
Noticed also https://ask.libreoffice.org/en/question/162708/automatic-update-of-external-links-has-been-disabled/ but this issue seems to be not connected with that setting whether updating links are updating automatically or not.
Comment 2 Edmund Laugasson 2018-10-20 18:03:19 UTC
Also wanted to mention that when such situation occur where .ods with externally linked data and shared mode is open and trying to unshare then it will not work - still remains shared. Deleting the external data linking from Edit->Links to external files... and then unsharing but still it will not turn off the sharing (next to filename in title bar still (shared) is written). But when hitting to Save then it says "This spreadsheet is no longer in shared mode" and only choice is OK and it asks to save under new name but I would like to not create yet another file but just turn off sharing and/or also linking if needed. Actually by turning off the sharing should be enough. But it seems that once the sharing is enabled while external data linking is enabled, it breaks something and there seems to be no way back to turn off sharing anymore.
Comment 3 Edmund Laugasson 2018-10-20 19:27:39 UTC
The last information after some testing is that even the sharing plays no role. While added linked data to same sheet where named cell block locates, saved document and when reopening - it says a warning message "Automatic update of external links has been disabled" regardless of Tools->Options->LibreOffice Calc->General->Update links when opening->Always (from trusted locations)
Comment 4 Rich 2019-02-09 04:30:49 UTC
I am having the problem with 6.2.0.3
I was using 5.2.4.2 without the problem. I had previously tried 6.1.4.2 and had to go back to 5 for other reasons. Don't remember haing the problem on 6.1.4.2
Comment 5 Rich 2019-02-09 04:45:19 UTC
It also fails in safe mode for me.
Comment 6 Buovjaga 2019-02-18 14:50:17 UTC
(In reply to Edmund Laugasson from comment #0)
> Actual Results:
> There is a warning "Automatic update of external links has been disabled"
> when opening file with linked data in shared mode. LibreOffice Calc will
> start consuming CPU intensively and will finally crash.

I could not repro. Used the Virtualbox shared folder method. Linux host, Win 10 guest. LibO 6.2.0 in both. Named range was simple, 3 cells with numbers. After an hour, CPU remained at 0% in both instances.

A trace of the crash would be nice. Edmund, Rich: neither of you sent a crash report? Alternatively: https://wiki.documentfoundation.org/QA/BugReport/Debug_Information
Comment 7 Rich 2019-02-18 21:12:17 UTC
My bad, perhaps I should have opened a new bug as mine is not the same as the OP describes. Mine seems the same as reported in Ask LibreOffice
with the title "Automatic update of external links has been disabled" several people reported this problem even though Tools/Options/LO Calc/General/Always
Although I get the message in a yellow bar at the top of the spreadsheet that says
""Automatic update of external links has been disabled" I do not get high CPU and crash.
I have created two simple files/spreadsheets that fail. 1_test.ods and 2_test.ods In file 2_test.ods I have cell a1 with an external link to cell a1 in 1_test.ods
This fails when I open 2_test.ods. Unfortunately you cannot test this directly as you do not have the same paths for the external link. But if you recreate the link it should fail.
Meanwhile I will readup on your link to debug information and will add what I can do.
Rich
Comment 8 Rich 2019-02-18 22:06:34 UTC Comment hidden (obsolete)
Comment 9 Rich 2019-02-18 22:08:32 UTC
Created attachment 149391 [details]
1 test file
Comment 10 Rich 2019-02-18 22:09:11 UTC
Created attachment 149392 [details]
2nd test file
Comment 11 Rich 2019-02-18 22:16:25 UTC Comment hidden (obsolete)
Comment 12 Buovjaga 2019-02-19 07:20:56 UTC Comment hidden (obsolete)
Comment 13 Buovjaga 2019-02-19 11:23:00 UTC
I repro the problem of the Automatic update question appearing regardless of the setting.

1. Tools - Options - LibreOffice - Security: Macro security - Trusted sources
2. Add the location of your spreadsheet with external link to the Trusted File Locations
3. Tools - Options - LibreOffice Calc - General - Update links when opening: change to Always (from trusted locations)

Arch Linux 64-bit
Version: 6.2.0.3
Build ID: 6.2.0-3
CPU threads: 8; OS: Linux 4.20; UI render: default; VCL: gtk3_kde5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Comment 14 Gregors 2019-02-21 11:35:41 UTC
Having same problem in windows 10 Version 1809 build 17763.316.
Links to external spreadsheets works fine in LO 6.0.7.3, but fails after update to LO 6.1.5, also tried LO 6.2.0 which fails. Gone back to 6.0.7.3 to be able to work.
Comment 15 Buovjaga 2019-02-24 20:24:09 UTC
Bibisected the prompting even when dir in Trusted locations and updating set to "Always" with win32-5.1 repo to https://gerrit.libreoffice.org/plugins/gitiles/core/+/77cc71476bae2b3655102e2c29d36af40a393201%5E!/

LinkUpdateMode is a global setting

Adding Cc: to Stephan Bergmann

Note to Stephan: the talk of crashing, sharing of spreadsheet in the beginning of this report is a red herring. A simple test case is having a target sheet with named range and the file that links to the target. Then using the steps in comment 13.
Comment 16 Buovjaga 2019-02-26 09:29:51 UTC
Stephan: argh, I am sorry: Tools - Share spreadsheet is a required step after all!
Comment 17 Stephan Bergmann 2019-02-26 10:13:05 UTC
(In reply to Buovjaga from comment #16)
> Stephan: argh, I am sorry: Tools - Share spreadsheet is a required step
> after all!

(Apparently, this needs to be done for the document containing the link (2_test.ods), not the linked-to document (1_test.ods), when going with the attachments from comment 9 and comment 10.)
Comment 18 Stephan Bergmann 2019-02-26 10:27:54 UTC
The reason for the "Automatic update of external links has been disabled. [Enable Content]" info bar is that the actually opened document is apparently a temporary copy (some <file:///tmp/lulmhoxl.tmp/0.ods> in my case), so that SvtSecurityOptions::isTrustedLocationUriForUpdatingLinks (unotools/source/config/securityoptions.cxx, introduced with <https://gerrit.libreoffice.org/plugins/gitiles/core/+/77cc71476bae2b3655102e2c29d36af40a393201%5E!/> "LinkUpdateMode is a global setting") returns false.

Maybe one of the Calc developers (now on CC) has an idea what should actually happen here?
Comment 19 Eike Rathke 2019-02-26 12:53:41 UTC
AFAIK there's no automatic "if this is a temporary copy because of a shared document then use the original path instead of the path of the copy" fallback for such case.

There's SfxObjectShell::IsDocShared() and SfxObjectShell::GetSharedFileURL() which ScDocShell inherits and sounds about right to use in calls to SvtSecurityOptions::isTrustedLocationUriForUpdatingLinks() (or a second call if the original call fails and IsDocShared()?)
Comment 20 Commit Notification 2019-02-26 20:16:35 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/1663b1e8233db6c6d1c2b35639ad984961084009%5E%21

tdf#120736: For Calc shared documents also check the original document URL

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 21 Buovjaga 2019-02-26 20:25:02 UTC
Seems to be working now, thanks!

Arch Linux 64-bit
Version: 6.3.0.0.alpha0+
Build ID: 1663b1e8233db6c6d1c2b35639ad984961084009
CPU threads: 8; OS: Linux 4.20; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 26 February 2019