Bug 80776 - FILEOPEN: read-only keeps file open
Summary: FILEOPEN: read-only keeps file open
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
4.2.5.2 release
Hardware: Other Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Read-Only
  Show dependency treegraph
 
Reported: 2014-07-01 23:54 UTC by pb
Modified: 2018-09-22 21:29 UTC (History)
2 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 pb 2014-07-01 23:54:36 UTC
Observed in Calc with xls file;  I did not look at other components.

If a file is opened in read-write mode (the default), then toggled to read-only (using the 'edit file' button, the file is still kept open (now apparently in read-only mode) (based on my observations using sysinternals process explorer).  As far as I can tell, there is no need to keep a read-only mode file open once it has been read in.  However, there is a good reason to close it once it has been read in.  Namely, Windows 7 (and no doubt later versions) will not permit a machine to sleep if it has a file opened across the network.

Meanwhile, it appears that if a file is initially opened in read-only mode (by checking the read-only check box in the open dialog), then the file is closed once it has been opened and read.

If my observations are correct, then this is inconsistent behavior, and when a file is toggled from read-write to read-only, the file should then be closed.
              
Operating System: Windows 7
Version: 4.2.5.2 release
Comment 1 raal 2015-04-05 20:27:53 UTC
Hello,
in sysinternal I doesn't see a difference between read only and normal file, but it's probably because I don't know what to watch. Please describe your observations. Thank you
Comment 2 pb 2015-04-05 20:34:13 UTC
(In reply to raal from comment #1)
> Hello,
> in sysinternal I doesn't see a difference between read only and normal file,
> but it's probably because I don't know what to watch. Please describe your
> observations. Thank you

I'm not sure what you mean by "see a difference between read only and normal file"?

If the file is read-only, calc does not need to keep an open file handle to it after it has read it in, hence it should not even show in process explorer.
Comment 3 raal 2015-04-06 11:04:27 UTC
Finally I've found where to see open files in sysinternals..

I can confirm with Version: 4.5.0.0.alpha0+
Build ID: ea59d42d2098e8be8b3ab9667922e8427ee4b714
TinderBox: Win-x86@42, Branch:master, Time: 2015-03-23_01:47:57
file type xlsx, ods.

In linux I doesn't see this behaviour, after set Edit/read only is lsof command empty.