Bug 137793 - LibreOffice doesn't remove the lock file after having opened a file and recognized that it has a read-only setting
Summary: LibreOffice doesn't remove the lock file after having opened a file and recog...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-27 11:03 UTC by Mark Sammon
Modified: 2021-04-29 08:10 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Empty Spreadsheet, created as "new empty file", but then saved as xlsx and marked as "open in write protect mode" (4.71 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2021-04-26 10:00 UTC, Peter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Sammon 2020-10-27 11:03:10 UTC
A user has created a file in MS Excel and set it to protected mode which defaults the user to open the file in Read Only mode.

When opening the file in MS Excel, this correctly opens in Read Only mode and only when you try to "Enable Editing" does the file switch to Read-Write mode.

When opening (by double clicking on the file) the same file in LibreOffice it correctly opens in Read Only mode (as shown on the task bar) but it still creates a -lock file. When a second user opens the file in MS Excel or LibreOffice the file says it is locked and can only be opened in Read Only mode.


Now with the document closed in both Excel and LibreOffice ....
Open LibreOffice and from the File Menu, open the document but tick the "Read Only" checkbox and proceed to open the document.  Now the document pens but NO .~lock file is created.
Now when opening a second instance of the document from either LibreOffice or Excel the application correctly assumes the document is not locked by a user and thus opens the document. 


The bug here seems to be when you open the document by double clicking on the file and opening in LibreOffice instead of Opening the document in RO mode from the File/Open menu.


I have tested this in LibreOffice 6.4.5 and 7.0.0+

Thank you
Comment 1 [REDACTED] 2020-10-27 16:44:45 UTC
> 
> The bug here seems to be when you open the document by double clicking on
> the file and opening in LibreOffice instead of Opening the document in RO
> mode from the File/Open menu.
> 

From my perspective the issue is that LibreOffice doesn't honor the "Open Read-Only" setting from the document at all when it comes to create a lock file or not. A lock file is always created, regardless of the documents settings. Only selecting "Read-Only" in the file picker dialogs prevents from lock file creation.
Comment 2 [REDACTED] 2020-10-27 16:51:48 UTC
> From my perspective the issue is that LibreOffice doesn't honor the "Open
> Read-Only" setting from the document at all when it comes to create a lock
> file or not. A lock file is always created, regardless of the documents
> settings. Only selecting "Read-Only" in the file picker dialogs prevents
> from lock file creation.

... and I'd state the bug the following: LibreOffice doesn't remove the lock file after having opened a file and recognized that it has a read-only setting.
Comment 3 Xisco Faulí 2020-11-30 12:46:36 UTC
You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
else confirms it.
Comment 4 Justin L 2020-12-24 13:27:53 UTC
Attaching an example file in protected mode would be nice...
I tried to create a protected spreadsheet in Excel 2003, and failed.
Comment 5 Peter 2021-04-26 10:00:59 UTC
Created attachment 171410 [details]
Empty Spreadsheet, created as "new empty file", but then saved as xlsx and marked as "open in write protect mode"
Comment 6 Peter 2021-04-26 10:04:37 UTC
This is an (otherwise empty) spreadsheet. When opened in Calc by double clicking, there are created:
.~lock.OpenDocument Tabellendokument (neu).xlsx#
~$OpenDocument Tabellendokument (neu).xlsx

Calc is nevertheless in write protected mode.

Calc 7.0.4.2 (x64), Win 10
Comment 7 Peter 2021-04-26 10:06:50 UTC
Sorry, don't know which files are created (and immediatley deleted, maybe?). I meant "there are existing"
Comment 8 Peter 2021-04-26 13:18:50 UTC
example file added
Comment 9 Peter 2021-04-29 08:10:36 UTC
(In reply to Peter from comment #5)
> Created attachment 171410 [details]
> Empty Spreadsheet, created as "new empty file", but then saved as xlsx and
> marked as "open in write protect mode"

Of course the other way around. 1st created (by means of explorer's "new file" menu, opened with Calc 7.0.4.2, there marked as ..., then saved as xlsx