52909Re: Race condition during file saving
- Jan 4, 2009Nikolai Weibull wrote:
> On Sun, Jan 4, 2009 at 23:19, Charles E. Campbell, Jr.Nikolai -- you're getting a bit sensitive here -- it was "simply to fill
> <drchip@...> wrote:
>> Nikolai Weibull wrote:
>>> No, I mean both O_EXCL (so that a file hasn't been created in between
>>> the time the original file has been renamed and the new one opened - a
>>> case so far not mentioned (or?)) and flock:ing it (but, as I
>>> understand from the man page, this doesn't seem to be very interesting
>> If you're talking Unix/Linux/etc -- flock is a cooperative file locking
>> mechanism, and processes which ignore it are not impeded.
> Just to make sure, did you read the part where I wrote "[flock]
> doesn't seem to be very interesting either"?
> I just want to know what your intentions were.
> Was it simply to fill in extra information about why I wrote that?
> Or did it seem like I didn't know what I was talking about and you
> wrote this reply to correct me?
> I'm finding that I get a lot of replys, especially at work, where I
> get the feeling that my mail hasn't really been read through. A
> classic is where you ask someone two questions and you get a reply
> with an answer for the first one. Or where you answer two questions
> and they restate the second one in their reply.
> Either way, I really don't think we have a problem to fix. I /want/
> to be able to read what a program is writing to a file, mid-write.
> Generally, when a long process is executing I want to be able to tell
> what's being written. If you're writing to a file that another
> program critically needs /that's/ your problem. Not whether you made
> sure to set up some intricate locking mechanism or not.
in extra information...", as you hadn't explained why flock "wasn't
Plus I added the mandatory kernel-enforced locking information.
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.
Personally, I agree with you that there's not a problem to fix; at most,
there's new behavior (that wishlist stuff) that someone may want. To
avoid the need for cooperative editing, use cvs/git/etc and use separate
copies and repositories. Editing log files is likely to remain
problematic and requires more than just vim to change (unless the
logging process already uses flock, perhaps I'll look into it sometime).
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>