*BSD News Article 13988


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!swrinde!gatech!emory!ogicse!psgrain!ee.und.ac.za!hippo!kudu!g89r4222
From: g89r4222@kudu.ru.ac.za (Geoff Rehmet)
Newsgroups: comp.os.386bsd.bugs
Subject: Patches: locate.updatedb and crontab Makefile
Message-ID: <g89r4222.733934656@kudu>
Date: 4 Apr 93 14:44:16 GMT
Article-I.D.: kudu.g89r4222.733934656
Sender: news@hippo.ru.ac.za (Usenet News Admin)
Organization: Rhodes University, Grahamstown, South Africa
Lines: 104


Attached to this post are diffs to fix the following problems:

1) In the script /usr/libexec/locate.updatedb sort is called with
a -T option, which the version of sort in 386bsd does not have. 
A patch to /usr/src/libexec/locate/locate/updatedb.csh fixes
this, simply by removing the -T option from all of the calls to
sort.

2) The crontab command (/usr/bin/crontab) should be owned by
root, and be mode 4555 - ie. it needs to be installed as a setuid
program, otherwise ordinary users cannot change their crontab
files.  This can be fixed by a small patch to
/usr/src/usr.bin/crontab/Makefile.  

(Both of these changes were made AFTER installing patchkit 0.2.2)

(To take effect, both of these patches require you to make and
make install the relevant programs.)


Geoff.


(Shar archive of the above patches follows.)

>------------------ Cut here -------------------------------
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	Makefile.crontab.diff
#	updatedb.diff
#
echo x - Makefile.crontab.diff
sed 's/^X//' >Makefile.crontab.diff << 'END-of-Makefile.crontab.diff'
X*** /usr/src/usr.bin/crontab/Makefile.orig	Sun Apr  4 14:29:12 1993
X--- /usr/src/usr.bin/crontab/Makefile	Sun Apr  4 14:30:02 1993
X***************
X*** 3,8 ****
X--- 3,10 ----
X  SRCS=	crontab.c misc.c entry.c env.c
X  CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../libexec/crond -DDEBUGGING=1 -DBSD -DCRONDIR='"/var/cron"' -fstrength-reduce
X  MAN5=	crontab.0
X+ BINOWN= root
X+ BINMODE=4555
X  
X  .include <bsd.prog.mk>
X  .PATH: ${.CURDIR}/../../libexec/crond
END-of-Makefile.crontab.diff
echo x - updatedb.diff
sed 's/^X//' >updatedb.diff << 'END-of-updatedb.diff'
X*** /usr/src/usr.bin/locate/locate/updatedb.csh.orig	Sun Apr  4 11:34:33 1993
X--- /usr/src/usr.bin/locate/locate/updatedb.csh	Sun Apr  4 11:36:33 1993
X***************
X*** 37,42 ****
X--- 37,46 ----
X  #	@(#)updatedb.csh	5.1 (Berkeley) 4/2/91
X  #
X  
X+ # Modified to remove the -T option from all of the sort calls
X+ # Geoff Rehmet, Rhodes University <csgr@alpha.ru.ac.za>
X+ # 4/4/93
X+ 
X  set SRCHPATHS = "/"			# directories to be put in the database
X  set LIBDIR = /usr/libexec		# for subprograms
X  if (! $?TMPDIR) set TMPDIR = /var/tmp	# for temp files
X***************
X*** 58,68 ****
X  # find ${SRCHPATHS} -print | \
X  find ${SRCHPATHS} ! -fstype local -a -prune -o -print | \
X  	tr '/' '\001' | \
X! 	(sort -T /var/tmp -f; echo $status > $errs) | tr '\001' '/' > $filelist
X  
X  $LIBDIR/locate.bigram < $filelist | \
X! 	(sort -T /var/tmp; echo $status >> $errs) | \
X! 	uniq -c | sort -T /var/tmp -nr | \
X  	awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $bigrams
X  
X  # code the file list
X--- 62,72 ----
X  # find ${SRCHPATHS} -print | \
X  find ${SRCHPATHS} ! -fstype local -a -prune -o -print | \
X  	tr '/' '\001' | \
X! 	(sort  -f; echo $status > $errs) | tr '\001' '/' > $filelist
X  
X  $LIBDIR/locate.bigram < $filelist | \
X! 	(sort ; echo $status >> $errs) | \
X! 	uniq -c | sort  -nr | \
X  	awk '{ if (NR <= 128) print $2 }' | tr -d '\012' > $bigrams
X  
X  # code the file list
END-of-updatedb.diff
exit


--
============================csgr@alpha.ru.ac.za===============================
 Geoff Rehmet, Parallel Processing Group, |#define DISCLAIMER These are my
 Computer Science Department,             |         ramblings, not the
 Rhodes University, RSA.                  |         University's