On Sun, Feb 09, 2020 at 12:33:42AM +0100, Joerg Jung wrote: > Hi, > > I have a machine with a large data storage attached, but it has only 2GB > of /tmp (which I consider enough usually). On this machine weekly > locate.updatedb fails, due to /tmp being full. To fix this I would like > to point locate to a different TMPDIR. > > But it seems one can not just set TMPDIR from /etc/locate.rc to point > elsewhere, since command line args in /etc/weekly override > /etc/locate.rc settings.
Below is a second diff, which tries to document that behaviour. > While it's possible to add a weekly.local to set TMPDIR I believe it > should be better set in the actual configuration file instead of > ignoring locate.rc. > > Thus the diff below proposes to remove command line argument to be able > to use /etc/locate.rc instead. > > Note, this might break existing setups, where one has set TMPDIR in > /etc/weekly.local to point elsewhere. This might be handled with a > -current upgrade entry? > > Comments? OK? > > Thanks, > Regards, > Joerg > > > Index: etc/weekly > =================================================================== > RCS file: /cvs/src/etc/weekly,v > retrieving revision 1.29 > diff -u -p -r1.29 weekly > --- etc/weekly 30 Dec 2019 16:49:51 -0000 1.29 > +++ etc/weekly 8 Feb 2020 23:13:02 -0000 > @@ -48,7 +48,7 @@ if [ -f /var/db/locate.database ]; then > if TMP=`mktemp /var/db/locate.database.XXXXXXXXXX`; then > trap 'rm -f $TMP; exit 1' 0 1 15 > UPDATEDB="/usr/libexec/locate.updatedb" > - echo "${UPDATEDB} --fcodes=- --tmpdir=${TMPDIR:-/tmp}" | \ > + echo "${UPDATEDB} --fcodes=- | \ > nice -5 su -m nobody 1>$TMP > if [ $? -ne 0 ]; then > echo "Rebuilding locate database failed" > Index: usr.bin/locate/locate/locate.updatedb.8 =================================================================== RCS file: /cvs/src/usr.bin/locate/locate/locate.updatedb.8,v retrieving revision 1.18 diff -u -p -r1.18 locate.updatedb.8 --- usr.bin/locate/locate/locate.updatedb.8 10 Dec 2009 00:45:43 -0000 1.18 +++ usr.bin/locate/locate/locate.updatedb.8 8 Feb 2020 23:44:41 -0000 @@ -54,6 +54,7 @@ script. The contents of the newly built database can be controlled by the .Pa /etc/locate.rc file as well as the command line arguments. +Command line arguments override rc file and defaults. .Pp The options are as follows: .Bl -tag -width Ds