From owner-freebsd-questions Wed Oct 17 22:30:24 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mobil.cz (nat3.mobil.cz [194.213.62.3]) by hub.freebsd.org (Postfix) with ESMTP id 8F53637B401 for ; Wed, 17 Oct 2001 22:30:21 -0700 (PDT) Received: (from roman@localhost) by mobil.cz (8.11.6/8.11.6) id f9I5YNr66030 for freebsd-questions@freebsd.org; Thu, 18 Oct 2001 07:34:23 +0200 (CEST) (envelope-from neuhauser@mobil.cz) X-Authentication-Warning: roman.mobil.cz: roman set sender to neuhauser@mobil.cz using -f Date: Thu, 18 Oct 2001 07:34:23 +0200 From: Roman Neuhauser To: freebsd-questions@freebsd.org Subject: locate.update runs even if it cannot write the results Message-ID: <20011018073423.C36953@roman.mobil.cz> Mail-Followup-To: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --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