[Libreoffice] locking semantics ...

Michael Meeks michael.meeks at suse.com
Mon Nov 14 06:39:12 PST 2011


On Mon, 2011-11-14 at 15:23 +0200, Tor Lillqvist wrote:
> In both cases, just knowing *who* is holding the document open would be enough.

	'Who' is of course something that we can get incredibly quickly from
the operating-system, and is already in the file.

	Of course, this doesn't deal with the hacker use-case of having dozens
of LibO open on lots of different systems, and forgetting where you left
them all but ... ;-) [ hopefully that is a minority use-case ].

	We already have the user name + account in the .~lock file I guess; but
we could prolly do quite a lot better here:

	* detecting whether the file is on a network file-system;
	  if not - warning about other users using it is pretty
	  lame ;-)
		+ the downer being that reliably detecting file-system
		  type is quite 'fun' - but we do dozens of
		  lstat walks down the file-system already anyway so ...

	* storing the <pid> of the relevant process in the .lock
	  file, such that if the system-names match we can verify if
	  indeed the .lock file is just stale

	* removing .lock files when we select to open a copy, so they
	  don't sit around indefinately causing grief when created.

	* silently deleting lock files if thy are > a week old (and
	  file remains un-touched for that time)
		+ where 'week' is customiseable by the paranoid

	Or is that highly controversial ? :-) if not, I'll create an 'easy'
hack or two I guess.

	ATB,

		Michael.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list