Loading ...
Sorry, an error occurred while loading the content.

Re: Race condition during file saving

Expand Messages
  • Nikolai Weibull
    ... ? ... That s what crontab -e is for, among other things. --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_dev
    Message 1 of 19 , Jan 4, 2009
    • 0 Attachment
      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 2 of 19 , Jan 4, 2009
      • 0 Attachment
        >> 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.