Bug 131693 - Unable to open document if path has "\\?\" UNC prefix in Windows
Summary: Unable to open document if path has "\\?\" UNC prefix in Windows
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.4.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-30 06:49 UTC by Tomas
Modified: 2023-06-30 03:13 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas 2020-03-30 06:49:53 UTC
Description:
If the path to the document exceeds MAX_PATH, Windows adds "\\?\" UNC prefix to the path. However, LibreOffice evaluates it as invalid path and crashes. If I remove the prefix, the document can be opened even if path is much longer than MAX_PATH.

Steps to Reproduce:
1. Enable long path support in Win 10
2. Double click document, that is saved at path longer than 260 chars


Actual Results:
Splash screen of LibreOffice appears and shuts down after a while.

Expected Results:
Should open the document.


Reproducible: Always


User Profile Reset: No



Additional Info:
When opening over Open dialog in LibreOffice, everything works fine. Even directly called with path without "\\?\" prefix, the document opens.
Comment 1 Buovjaga 2020-09-04 14:37:11 UTC
The problem seems to be broader, affecting UNC prefix as a whole: bug 91851. Do you agree?
Comment 2 Mike Kaganski 2020-11-30 11:14:48 UTC
(In reply to Buovjaga from comment #1)
No. The problem here is specifically with "\\?\" prefix, not handled in INetURLObject::convertRelToAbs and INetURLObject::setAbsURIRef, both used from GetURL_Impl in desktop/source/app/app.cxx.

This results in the URL like "file:////?/C:/...", which then is converted back to system path in osl_getSystemPathFromFileURL_ (sal/osl/w32/file_url.cxx), which strips "file:///", and the rest "/?/C:/..." is not a valid path.

This can be easily fixed by a modification of osl_getSystemPathFromFileURL_ to test for starting with "file:////?/" and then skipping only 7 characters, but it seems that the proper fix is in INetURLObject, which should in theory behave just like osl_getFileURLFromSystemPath for such paths, simply dropping "\\?\" from the result URL.

However, I hesitate to touch this code myself (too fragile); Stephan, could you take a look at it please?
Comment 3 QA Administrators 2023-06-30 03:13:29 UTC
Dear Tomas,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug