Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: [News] Windows File Locking Usability Bugs

At least Widows has locking that works.  As I noted once before:

    In Linux and Solaris, mandatory locks only work on local filesystems.
    In Linux, the filesystem has to have been mounted with mandatory lock
    support (which is not the default).  The "Secure Programming Cookbook
    for C and C++" by Viega and Messier from O'Reilly puts it this way: 

       In the end, Solaris is really the only Unix variant on which you can
       reasonably expect mandatory locking to work, and even then, relying
       on mandatory locks is like playing with fire. 

       As if the story for mandatory locking on Unix were not bad enough
       already, it gets worse.  To be able to use mandatory locks on a file,
       the file must have the setgid bit enabled the the group execute bit
       disabled in its permissions.  Even if a process holds a mandatory
       lock on a file, another process may remove the setgid bit from the
       file's permissions, which effectively turns the mandatory lock into
       an advisory lock! 

       Essentially, there is no such things as a mandatory lock on Unix. 

       Just to add more fuel to the fire, neither Solaris nor Linux fully or
       properly implement the System V defined semantics for mandatory
       locks, and both systems differ in where they stray from the System V
       definitions.  The details of the differences are not important here.
       We strongly recommend that you avoid the Unix mandatory locking
       debacle altogether.  If you want to use advisory locking on Unix,
       then we recommend using a standalone lock file, as described in
       Recipe 2.9. 

    If your architecture really needs mandatory locks, then you have to
    seriously consider whether it might make more sense to run on Windows.
    Locks work correctly over there. 

-- 
--Tim Smith

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