[patch for 1.6.2] dot-file locking



This patch adds locking capabilities to gnumeric version 1.6.2,
preventing modification of the same workbook by multiple users or
program instances.

The mechanism used is creation of hidden (on UNIX at least) lock files
(lock filename syntax: DOT <workbookname> DOT lock).  A lock file is
created for each named workbook that is opened.  The lock file
contains the ascii string "user host (uid xxx, pid xxx)" to identify
the holder of the lock.

If a locked workbook is opened by gnumeric, the user will be informed
of the lock and be told of the current lock holder (and some
explanation of why the file might be locked).  The SAVE functionality
will also be disabled for workbooks where the lock is held by an
external party.  To save data, the user must use SAVE-AS.

Attempts are made to discover failures when they occur (such as a
lockfile being deleted by a crafty user), and to tolerate them when
possible.  I have done some testing to verify that locking works in
the obvious foreseeable cases.

As an aside, there was some discussion on this list of implementing
similar locking mechanisms a few years back.  From what I have
gleaned, my patch should exceed the functionality of those earlier
contributions.  Hopefully others find it useful.  Constructive
comments (or bug reports) are appreciated.

Cheers,

Tammo

Attachment: gnumeric-dotlocking-u6.patch
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]