Bug 158816 - Dependence on ~/Documents
Summary: Dependence on ~/Documents
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-21 22:47 UTC by graham
Modified: 2024-03-27 03:18 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
master spreadsheet demonstrating the problem (75.44 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-12-21 22:51 UTC, graham
Details
one of the subsidiary spreadsheets on the same directory as the master (27.88 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-12-21 22:53 UTC, graham
Details
Menu; Edit; Links to external files (75.68 KB, image/png)
2023-12-22 02:40 UTC, graham
Details
Screenshot of Edit; Links to External Files dialog (76.38 KB, image/png)
2023-12-30 23:39 UTC, graham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description graham 2023-12-21 22:47:42 UTC
Description:
I have a 'master' spreadsheet which aggregates data from a lot of other spreadsheets in the same directory. When I open this 'master' spreadsheet it errors once per external file referenced: 
"The following external file could not be loaded. Data linked from this file did not get updated. 
file://home/graham/Documents/solarview+2023+killigray-elevation-60-azimuth-60W-table_mhr-monthly.ods"
 
Once the 'master' is open there is no apparent missing data. There are no files in /home/graham/Documents/, I almost never use it. All the files referenced are actually in the same directory as the 'master' ie /home/graham/projects/killigray/energy/insolation/ and seem to actually get loaded OK. I search in the 'master' for Documents in All sheets, Documents is not found in either Value or Formulas. 
So I conclude there is some hard coded dependence on /home/$USER/Documents/ 

Steps to Reproduce:
1.Open attached spreadsheet. 
2.Witness error dialogs
3.

Actual Results:
Error dialogs as described. 
This is not resolved by re-saving the file. 

Expected Results:
None of these error dialogs should have been displayed- there are no actual errors affecting the data load.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
The subsidiary files to load are identified by formulae which create their filenames (with no path) from hard-coded values in Sheet1 like:
="solarview+2023+killigray-elevation-60-azimuth-"&F3&"-table_mhr-monthly"
If I change the formula to
="./solarview+2023+killigray-elevation-60-azimuth-"&F3&"-table_mhr-monthly"
then the same errors still occur on loading the master spreadsheet but it actually cannot load the subsidiary spreadheets from the current directory. 

In Safe mode the 'master' sheet does not load all subsidiary sheets automatically, instead "Security Warning Automatic update of external links has been disabled.". When I click Allow updating the problem as described above is replicated.
Comment 1 graham 2023-12-21 22:51:23 UTC
Created attachment 191553 [details]
master spreadsheet demonstrating the problem
Comment 2 graham 2023-12-21 22:53:45 UTC
Created attachment 191554 [details]
one of the subsidiary spreadsheets on the same directory as the master

This data shows up in the master spreadsheet Sheet1 column F.
Comment 3 graham 2023-12-21 22:56:24 UTC
Tools; Options; LibreOffice; Paths, My Documents is set to /home/graham/Documents
Comment 4 m_a_riosv 2023-12-22 02:19:37 UTC
Test if it is related to:
Menu/Tools/Options/Load&Save/General - Save URLs relative to file system.
Maybe you have save the file with the option disable.
Comment 5 graham 2023-12-22 02:26:04 UTC
Thanks for giving this some attention.

I have checkmarks next to both "Save URLs relative to filesystem" and "Save URLs relative to internet", and I have certainly saved the file since that was set. 

It is possible that I first saved the file with that not set, but I have no way to go back and check.
Comment 6 m_a_riosv 2023-12-22 02:28:48 UTC
Maybe, but you can go Menu/Edit/Link to external data - Select Modify and selecting again the file.
Comment 7 graham 2023-12-22 02:40:40 UTC
Created attachment 191555 [details]
Menu; Edit; Links to external files

This is what I see when I go to Edit; Links to external files.

In each case only the file name is shown in the list but when expanded below the /home/graham/Documents/ is prepended.

If I 'Break Link' on one of the external files, then save and exit, when I re-open the file then I am not prompted regarding that file any more (as expected).

And the data in the column which is supplied by the file of the same name in the current directory (same as the 'master' spreadsheet) is still there in the master, so clearly it is coming from the correct sub-sheet, not the phantom in /home/graham/Documents/ 

So for me, I can resolve this issue just by breaking all the links, and I knew that. I am just bringing this up as a bug so that no-one in future needs to go through the troubleshooting exercise.

Thanks!
Comment 8 QA Administrators 2023-12-22 03:13:34 UTC Comment hidden (obsolete)
Comment 9 m_a_riosv 2023-12-22 15:35:09 UTC
If you select modify in edit-links, you can select again the file, without break the link.
Comment 10 raal 2023-12-30 17:40:13 UTC
Hello, if I understand correctly the discussion, we can close the bug.
Comment 11 graham 2023-12-30 23:38:46 UTC
Thanks for taking an interest, but this advice is just what I can do to make the error messages go away. 

It does not address how the errors arose, so the bug is not fixed.   

Also, the method proposed in the advice gives a nice route to breaking the spreadsheet concerned. In the dialog where I am advised to remove the links, there is no clue where the links are in the spreadsheet and therefore, what I should expect them to do. Only by trial and error, will the user find out whether the calculation involving the links is now broken. Perhaps the cell reference is in the Element column of that dialog box? There is nothing in that column for me, is that evidence that there is somehow a link to the file but not to anything in the file?  I will try to add a screen grab to show this.
Comment 12 graham 2023-12-30 23:39:58 UTC
Created attachment 191662 [details]
Screenshot of Edit; Links to External Files dialog
Comment 13 graham 2023-12-31 00:01:42 UTC
Further to this report:

If I use the Edit; Links to External Files and use the Modify button, I can select the same named file in the current directory BUT clicking Insert (closing the Modify dialog) take me back to the Links to External Files dialog, which still shows the full path as being my $HOME/Documents/ rather than the actual directory. 

If I close the Links to External Files dialog and reopen it that linked file is now shown as being in the correct location, but the other files are still shown as being in my $HOME/Documents/. 

If I now save the file, restart LOCalc and open the spreadsheet again, I STILL get the error on opening, from the file where I previously selected that file in my data directory- the error says it is in my $HOME/Documents/ along with the others I did not change.  And going back to the Links to External Files dialog, this file is still shown there as being in my $HOME/Documents/

So I really do not believe this bug report should be closed without a fix.

What more information can I supply to help the team find the error? 

Thanks
Graham
Comment 14 m_a_riosv 2023-12-31 01:11:32 UTC
LibreOffice always shows the full path, even relative path is saved.
Comment 15 graham 2023-12-31 01:28:52 UTC
"LibreOffice always shows the full path, even relative path is saved."

I don't understand this comment in context. 

I don't know what path LibreOffice actually saves, all I can say is that is expects (on opening) these files to be in my $HOME/Documents/ whereas they only ever exist in my $HOME/projects/killigray/energy/insolation/ (where the spreadsheet that gets data from them lives also). 

If it were correctly saving the relative path, then it would not generate these errors on opening the spreadsheet because, relative to the spreadsheet being opened, these subsidiary spreadsheets are actually in the same directory.
Comment 16 graham 2023-12-31 01:49:14 UTC
When I look at content.xml inside the 'master' spreadsheet I see repeated references to the subsidiary spreadsheets (without any path information). 

I never find any references to the word Documents (as in my $HOME/Documents/) nor to the word projects (as in my $HOME/projects/killigray/energy/insolation/ which is where all the files actually are). So I presume m.a.riosv is correct in saying that LibreOffice stores relative paths; which in this case is evaluated and saved as 'nothing' since they are in the same directory.

Therefore, something in the LibreOffice code is referring directly to $HOME/Documents as a default location to look in, ahead of the master spreadsheet's current directory.
Comment 17 graham 2024-03-27 03:18:29 UTC
Bump. Any ideas?