From f9404b1d6564ed0871843278ef4665483566830a Mon Sep 17 00:00:00 2001 From: jay Date: Sat, 9 Feb 2008 10:16:32 +0000 Subject: [PATCH] Rename the old locate database to the new name atomically. This fixes Savannah bug #22057. --- ChangeLog | 6 ++++++ NEWS | 5 +++++ locate/updatedb.sh | 10 ++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8744400..0d147e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-25 James Youngman + + * locate/updatedb.sh: Actually rename the old database to the new + one atomically, instead of just claiming the rename is atomic in a + comment :) This fixes Savannah bug #22057. + 2008-01-07 James Youngman * xargs/xargs.c: (main): Standardise on "Warning" instead of diff --git a/NEWS b/NEWS index df51eaf..e6c6fbe 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,11 @@ GNU findutils NEWS - User visible changes. -*- outline -*- (allout) * Major changes in release 4.3.13-CVS ** Bug Fixes + +#22057: Actually rename the old locate database to the new one +atomically, instead of just claiming the rename is atomic in a +comment. + #21960: xargs should collect the exit status of child processes even if the total count of unreaped children has not yet reached the maximum allowed. diff --git a/locate/updatedb.sh b/locate/updatedb.sh index dd514b3..9f4e4d9 100644 --- a/locate/updatedb.sh +++ b/locate/updatedb.sh @@ -289,9 +289,8 @@ fi # To avoid 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 - mv $LOCATE_DB.n $LOCATE_DB - chmod 644 $LOCATE_DB + chmod 644 ${LOCATE_DB}.n + mv ${LOCATE_DB}.n $LOCATE_DB else echo "updatedb: new database would be empty" >&2 rm -f $LOCATE_DB.n @@ -359,9 +358,8 @@ rm -f $bigrams $filelist # 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 - mv $LOCATE_DB.n $LOCATE_DB - chmod 644 $LOCATE_DB + chmod 644 ${LOCATE_DB}.n + mv ${LOCATE_DB}.n $LOCATE_DB else echo "updatedb: new database would be empty" >&2 rm -f $LOCATE_DB.n -- 2.11.4.GIT