[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Race-condition ?

From: Richard M. Stallman
Subject: Re: Race-condition ?
Date: Sun, 03 Jul 2005 11:49:03 -0400

    Some (including GNU mv and GNU cp) do even use chown and
    chmod in the same unsafe way that we did previously, so I will report
    that to them.

Thank you.

    Now, as for as I can tell, there is no way to move a file asking the
    user what to do if needed and avoid every race-conditions in a Unix-like
    OS. I will try to come with a solution that avoids the worse problems.

That is good.

     Those two ways will have different effects if the file we
    overwrite/remove has a link count > 1. Current emacs implementation use
    "overwrite mode" in copy and "remove mode" in rename if it is in the
    same filesystem,

Those are clearly the right things.  copy-file is defined to overwrite
an existing file; it would be wrong to do anything else (at least in
the default case).  Rename, in the case where it is implemented by the
rename system call, will replace the existing file.

                     but cross-filesystem rename use the "overwrite

In principle, that ought to replace the existing file, to be
consistent with other cases of renaming.

The easiest way might be to create an option (or reuse an existing
option) in copy-file, so that rename-file can continue to handle this
case by calling copy-file.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]