Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Oct 2001 07:34:23 +0200
From:      Roman Neuhauser <neuhauser@mobil.cz>
To:        freebsd-questions@freebsd.org
Subject:   locate.update runs even if it cannot write the results
Message-ID:  <20011018073423.C36953@roman.mobil.cz>

next in thread | raw e-mail | index | archive | help

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi there,

sometime last week I ran /usr/libexec/locate.updatedb by hand, only to
realize after 15 minutes of thrashing the disk that I'm not logged in as
root. The script failed because it couldn't write the db. I think that 
this is pretty annoying -- not the fact that I need to be root in order
to run this (if and when I want to run it by hand), but the fact that it
runs when it shouldn't. I wrote myself a little patch to save me some
time for the next time. 

Do you think a check like this belongs in the scripts? If it does, then
similar tests should be added to the other locate.* scripts as well,
which I'd be glad to do (I only patched this one so far).

Roman

--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="locate.updatedb.patch"

--- locate.updatedb.orig	Fri Oct 12 18:25:21 2001
+++ locate.updatedb	Thu Oct 18 07:21:19 2001
@@ -50,6 +50,10 @@
 : ${FILESYSTEMS:="ufs"}			 # allowed filesystems 
 : ${find:=find}
 
+if [ ! -w $FCODES ]; then
+    echo "$0: cannot write $FCODES"; exit 1;
+fi
+
 case X"$SEARCHPATHS" in 
 	X) echo "$0: empty variable SEARCHPATHS"; exit 1;; esac
 case X"$FILESYSTEMS" in 

--3MwIy2ne0vdjdPXF--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011018073423.C36953>