[Top][All Lists]

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

Re: Bug#461585: [bug #22057] updatedb "atomic rename" is not atomic

From: Justin Pryzby
Subject: Re: Bug#461585: [bug #22057] updatedb "atomic rename" is not atomic
Date: Sat, 19 Jan 2008 16:01:17 -0500
User-agent: Mutt/1.5.16 (2007-06-11)

On Sat, Jan 19, 2008 at 07:04:44PM +0000, Andreas Metzler wrote:
> Details:
> This is http://bugs.debian.org/461585
> 8X-----------------------------------
> An atomic rename involves a "mv" without an "rm", with the chmod on
> the .n file beforehand.
> |# To reduce the chances of breaking locate while this script is running,
> |# put the results in a temp file, then rename it atomically.
> |if test -s $LOCATE_DB.n; then
> |  rm -f $LOCATE_DB
> |  chmod 644 $LOCATE_DB
> |else
> 8X-----------------------------------
> I am forwarding this, since I am undecided whether this is actually a bug.
> Replacing
> rm ; mv ; chmod
> with 
> chmod 644 $LOCATE_DB.n
> has the bonus that $LOCATE_DB is present all the time. The downside is that
> an already running locate process might act strangely if its input data is
> changing.
It shouldn't act strangely, since it does fopen(), so locate sees the
instance of the file that exists at that point in time (and the file
descriptor prevents the kernel from "really" removing the file until
it's fclosed).

reply via email to

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