Loading ...
Sorry, an error occurred while loading the content.
Skip to search.
 

Re: Race condition during file saving

Expand Messages
  • Adam Osuchowski
    ... So what is your advice? Ignore it? It s very comfortable to call flows features, we have perfect situation and don t need to worry about consequences. ...
    Message 1 of 19 , Jan 4, 2009
      Nikolai Weibull wrote:
      > Either way, I really don't think we have a problem to fix.

      So what is your advice? Ignore it? It's very comfortable to call flows
      features, we have perfect situation and don't need to worry about
      consequences.

      > If you're writing to a file that another program critically needs
      > /that's/ your problem.

      Configuration file, for example, is critically for almost every daemon.
      Do you think that it is only my problem? No, it is very real scenario
      which could happen to everyone who use vim.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Adam Osuchowski
      ... I didn t tell about multiple people editing the same file or editing log files. I told about _ONE_ person editing file which could be read by another
      Message 2 of 19 , Jan 4, 2009
        Charles E. Campbell, Jr. wrote:
        > Likely areas for problems like this concern cooperative editing (ie.
        > multiple people editing the same file) and editing log files (or other
        > files which are potentially being written to by some other program).
        > Vim isn't designed for cooperative editing; I seem to recall it being on
        > a wishlist, though. Editing log files is problematic because they
        > generally aren't using mandatory file locking.

        I didn't tell about multiple people editing the same file or editing log
        files. I told about _ONE_ person editing file which could be read by another
        process at the same time. Isn't vim designed for it too? Don't think so.

        > To avoid the need for cooperative editing, use cvs/git/etc and use separate
        > copies and repositories.

        And keep all /etc files in cvs repo? It's only pinning the blame on another
        application (cvs, in this case).

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Nikolai Weibull
        ... ? ... That s what crontab -e is for, among other things. --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_dev
        Message 3 of 19 , Jan 4, 2009
          On Mon, Jan 5, 2009 at 00:06, Adam Osuchowski <adwol@...> wrote:

          > Nikolai Weibull wrote:

          >> Either way, I really don't think we have a problem to fix.

          > So what is your advice? Ignore it? It's very comfortable to call flows
          > features, we have perfect situation and don't need to worry about
          > consequences.

          ?

          >> If you're writing to a file that another program critically needs
          >> /that's/ your problem.

          > Configuration file, for example, is critically for almost every daemon.
          > Do you think that it is only my problem? No, it is very real scenario
          > which could happen to everyone who use vim.

          That's what crontab -e is for, among other things.

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Ben Schmidt
          ... He didn t mean it s your problem personally and that no other user would experience it. He meant it s your problem as the user, not the editor s problem.
          Message 4 of 19 , Jan 4, 2009
            >> If you're writing to a file that another program critically needs
            >> /that's/ your problem.
            >
            > Configuration file, for example, is critically for almost every daemon.
            > Do you think that it is only my problem? No, it is very real scenario
            > which could happen to everyone who use vim.

            He didn't mean it's your problem personally and that no other user would
            experience it. He meant it's your problem as the user, not the editor's
            problem.

            If you edit your config files, most likely you need to SIGHUP the daemon
            to reread it anyway. And if you don't, most likely the daemon is aware
            of the somewhat dumb practice of reading its config files at
            unpredictable intervals, and provides a device, such as crontab -e, to
            avoid problems, as has already been mentioned. Playing games moving
            temporary files around for the purpose of keeping daemons happy is not
            an editor's job, but the user's, or a utility such as crontab's.

            Having the editor write to a temporary file and move it into place has
            other worse effects as have already been mentioned (breaking of links,
            use of file descriptors by calling processes such as crontab -e, etc.).
            Indeed, other software sometimes expects the editor to overwrite the
            original file, which implies a time with an empty or partially written
            file.

            So although the current behaviour isn't really ideal, neither are the
            alternatives, and in fact, the alternatives are probably worse.

            It could be another option, I suppose, or incorporated into an existing
            one (it is only possible if writebackup and backup are unset or
            copybackup is yes, or there is a time of nonexistence of the file, which
            is just as bad), but is it worth the bother? How often are people
            actually bitten by this? Very rarely, I think, and the consequences are
            far from catastrophic when it happens. It couldn't be the default due to
            the other negative side effects of the method, too, so would have to be
            set when appropriate, which means you might as well use some other tool
            to do the job.

            Ben.




            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.