Bug 137937 - FILESAVE XLSX External cell reference path is extended by user home dirs path
Summary: FILESAVE XLSX External cell reference path is extended by user home dirs path
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium normal
Assignee: Attila Szűcs
URL:
Whiteboard: target:7.2.0 target:7.1.1
Keywords: bibisected, bisected, filter:xlsx, implementationError
Depends on:
Blocks: Cell-Reference
  Show dependency treegraph
 
Reported: 2020-11-02 14:57 UTC by NISZ LibreOffice Team
Modified: 2021-01-18 09:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Calc with cell references to c:\TEMP (10.12 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-11-02 14:57 UTC, NISZ LibreOffice Team
Details
The original file saved by Calc (6.56 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-11-02 14:57 UTC, NISZ LibreOffice Team
Details
Screenshot of the original and exported document side by side in Calc (84.59 KB, image/png)
2020-11-02 14:58 UTC, NISZ LibreOffice Team
Details
Example file used as cell reference target (26.50 KB, application/vnd.ms-excel)
2020-11-02 14:59 UTC, NISZ LibreOffice Team
Details
Example file used as cell reference target (8.07 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-11-02 14:59 UTC, NISZ LibreOffice Team
Details
Example file from Excel 2013 with the same cell references (10.40 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-11-02 15:02 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-11-02 14:57:29 UTC
Created attachment 166941 [details]
Example file from Calc with cell references to c:\TEMP

Attached ODS file contains a cell reference to a file in C:\TEMP directory.
When this file is saved to XLSX format the path to the file is extended with the users home directory name, i.e. ='file:///C:/TEMP/EDATAE13_B.xlsx'#$Munka1.A1 becomes ='file:///C:/Users/kelemengabo/Documents/TEMP/EDATAE13_B.xlsx'#$Munka1.A1 
This is similar to the situation mentioned here for Linux:
https://bugs.documentfoundation.org/show_bug.cgi?id=121472#c5 

Steps to reproduce:
    1. Open attached file
    2. Save as XLSX
    3. Reopen

Actual results:
Cell reference path changed, now it contains thes users own directories path.

Expected results:
Correct cell references.

LibreOffice details:
Version: 7.1.0.0.alpha1+ (x64)
Build ID: ec1f4d3253963ac16d638734ac70dde033e82154
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL

Also happens way back to:
Version: 4.4.0.3
Build ID: de093506bcdc5fafd9023ee680b8c60e3e0645d7
Locale: hu_HU

In 4.3 the exported reference was:
=['file:///c:/temp/edatae13_b.xlsx']munka1!a1
Which had a correct path, but it was otherwise incorrect and giving Err:509 error.

Additional Information: 

Bibisected using bibisect-win32-4.4 to:
https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=5c37960d9507fac206f0b90d36f778db9fe2b6a5..41e4a607b00f446eeaebf8f59c957a1a580c9517

of which the most likely starting commit is the initial implementation of this feature:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=8c23a767d926d8d08213f5e2f8e81775c653cbd7 

write OOXML externalReferences, externalLinks, fdo#45286
Comment 1 NISZ LibreOffice Team 2020-11-02 14:57:59 UTC
Created attachment 166942 [details]
The original file saved by Calc
Comment 2 NISZ LibreOffice Team 2020-11-02 14:58:13 UTC
Created attachment 166943 [details]
Screenshot of the original and exported document side by side in Calc
Comment 3 NISZ LibreOffice Team 2020-11-02 14:59:07 UTC
Created attachment 166944 [details]
Example file used as cell reference target
Comment 4 NISZ LibreOffice Team 2020-11-02 14:59:49 UTC
Created attachment 166945 [details]
Example file used as cell reference target
Comment 5 NISZ LibreOffice Team 2020-11-02 15:02:45 UTC
Created attachment 166946 [details]
Example file from Excel 2013 with the same cell references

This is opened correctly, but then it’s saved with the same error
Comment 6 Martin Srdoš 2020-11-16 18:03:48 UTC
Hello,

I don't know, if I can confirm my reproduction, because in the cell is not additioned of my user directory, but there is additioned path, where I save the XLSX file to. For example, I save the file from attachement 166941 (from your Description message) to "C:\users\[myName]\download\something\" and then, in the XLSX file, between "C:" and "\TEMP\" was added "\users\[myName]\download\something\". There is always added path, where I am saving the file to. Can you confirm that?
Comment 7 Commit Notification 2020-12-21 09:34:59 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/107a20ee079ae852b3b33412f234aab2dc35168f

tdf#138824 tdf#137937 XLSX export: fix parent directory path

It will be available in 7.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 8 NISZ LibreOffice Team 2021-01-11 13:59:20 UTC
Verified in:

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 96bafa464ebdbce3ef04bec9beae5e745bb37794
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded
Comment 9 Commit Notification 2021-01-18 09:40:04 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#138824 tdf#137937 XLSX export: fix parent directory path

It will be available in 7.1.1.

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.