Subject: bin/12372: locate.updatedb always exits with status 1
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jbernard@mines.edu>
List: netbsd-bugs
Date: 03/10/2001 12:01:56
>Number:         12372
>Category:       bin
>Synopsis:       locate.updatedb always exits with status 1
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 10 11:03:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jim Bernard
>Release:        March 10, 2001
>Organization:
>Environment:
System: NetBSD zoo 1.5S NetBSD 1.5S (ZOO-$Revision: 1.62 $) #0: Sat Feb 17 07:36:06 MST 2001 jim@zoo:/home/tmp/compile/sys/arch/i386/compile/ZOO i386
Architecture: i386
Machine: i386
>Description:
	locate.updatedb always exits with status 1.  The reason is:

	  trap 'rm -f $FILELIST; exit 1' 0 2 15

	which specifies an exit status of 1 even for normal exit.

>How-To-Repeat:
	Read the script.

>Fix:
	E.g., trap normal exit separately from interrupted exits.
	(The script lives in .../src/usr.bin/locate/locate.)

--- updatedb.sh-dist	Fri May  5 14:50:36 2000
+++ updatedb.sh	Sat Mar 10 11:46:57 2001
@@ -45,11 +45,12 @@
 export TMPDIR="${TMPDIR:-/tmp}"
 FCODES="/var/db/locate.database"	# the database
 
 PATH="/bin:/usr/bin"
 FILELIST="$TMPDIR/locate.list.$$"
-trap 'rm -f $FILELIST; exit 1' 0 2 15
+trap 'rm -f $FILELIST' 0
+trap 'rm -f $FILELIST; exit 1' 2 15
 
 # Make a file list and compute common bigrams.
 # Entries of each directory shall be sorted (find -s).
 
 # search locally or everything
>Release-Note:
>Audit-Trail:
>Unformatted: