Slashdot Mirror


Open File Locking and Mac OS X?

ArcticMyst asks: "In Mac OS X the responsibility of locking open files has moved from the operating system to individual applications. With the exception of Apple's most recent release of AppleWorks, I have not been able to find many applications written for Mac OS X that will lock a network resident file when it is opened. Not marking a file as locked allows more than one user to have a file open, then edit and save back to the original file. Even most of Apple's own applications fail to do this. Apple does provide information on how to make sure that open files are not edited while they are open. Why do so many applications fail to provide this security?"

4 of 33 comments (clear)

  1. Re:Lock the file before you open for write! by Otter · · Score: 5, Insightful
    They use fopen(), or they use fstream in C++, or they do it in Carbon or Cocoa in MacOS X....

    ...and while classic MacOS locked a file when you opened it with FSpOpenDF(), the Unix-based OS X doesn't automatically handle it. So, I'd guess the answer to the original question is that Unix-background developers don't lock OS X files because they don't lock files and Mac developers don't because they never had to worry about it before.

  2. ..file a bug report? by Anonymous Coward · · Score: 3, Insightful

    what is the deal? Your favorite application does not provide file locking? File a bug for this. Most of those coders just do not think about multiuser environments.

    1. Re:..file a bug report? by shylock0 · · Score: 4, Insightful
      I think we need to distinguish between a "bug" and the lack of a feature. Not locking a file, as can readily be evidenced by the rest of the comments in this thread, is not necessarily a bug.

      The concept of a bug is the most overused in the software world today. Software not acting how you want it to does not mean that its buggy. Software not working how the author intended it to, that's buggy.

      --
      Statistically speaking, there's a 99.998% chance that my IQ is higher than yours. Get over it.
  3. Re:Depending on how you code... by mithras+the+prophet · · Score: 4, Insightful

    Having a single process open a file to write, and multiple processes open that same file to read, is obviously not a problem.

    The problem is multiple processes opening a file for write.

    --
    four nine eighteen twenty-7 thirty-nine forty-7 fiftyeight sixty-nine seventy-9 eighty-8 one-hundred-and-nine one-twenty