[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2996: Bug #2996: Problems with updatedb in findutils-4.1



The following email was sent to the bug-gnu-utils mailing list.  It is
provided below for debian-bugs perusal.

In the Debian release of Linux, updatedb is run nightly with user id
nobody as follows:

su nobody -c "cd / && updatedb" 2>/dev/null

updatedb is from findutils-4.1-10, which includes some slight changes
from the standard GNU 4.1 release.  None of the changes are
significant for this problem.

One of the users (Miquel van Smoorenburg <miquels@cistron.nl>) tried
to use the --netpaths option to updatedb and run across a problem
unless updatedb is run as root, since updatedb tries to su, which is
difficult unless updatedb is run as root.  Miquel's suggestion was to
avoid su unless running as root.  His email is included below.

Here are some of my thoughts on this subject:

1.  If "su $NETUSER" is avoided, then there is not any difference
between the "find $NETPATHS" command and the previous find command
except for the fstypes and the regular expressions which are pruned.
This is probably a good idea so that the "--netpaths" option will
still work.

2.  I suggest adding an option, perhaps "-fsprune" which would
determine which file systems are pruned.  There would be an equivalent
environment variable FSPRUNE.  This solves another problem of
different users wanting to avoid different file systems.  The
following file systems are commonly requested for avoidance:

	afs, proc, alex

in addition to nfs.  It is a bad idea to have the file system fixed in
the updatedb shell.  This solution provides a second solution to
Miquel's problem as well as solving the file system problem.

I will probably introduce these changes to the Debian release within
the next few weeks, unless some sees an obvious problem to these
solutions.  Of course, the patches will also be sent to the
bug-gnu-utils list.

kevin@aimnet.com
Kevin Dalley


From: Miquel van Smoorenburg <miquels@cistron.nl>

> I wanted to let updatedb search a networked drive, so I changed the
> default /etc/cron.daily/find script to:

> su nobody -c "cd / && updatedb --localpaths='' --netpaths=/pub/"

> Unfortunately the script does a "su" to the "netuser" internally which
> is daemon, and ofcourse this wants a password..

> I've patched updatedb. Perhaps this should go back in the upstream version.

> --- updatedb.org	Tue May 14 23:25:40 1996
> +++ updatedb	Tue May 14 23:27:04 1996
> @@ -99,8 +99,12 @@
>  fi

>  if test -n "$NETPATHS"; then
> -  su $NETUSER -c \
> -  "$find $NETPATHS \\( -type d -regex \"$PRUNEREGEX\" -prune \\) -o -print"
> +  if [ "`whoami`" = root ]; then
> +    su $NETUSER -c \
> +    "$find $NETPATHS \\( -type d -regex \"$PRUNEREGEX\" -prune \\) -o -print"
> +  else
> +    $find $NETPATHS \( -type d -regex "$PRUNEREGEX" -prune \) -o -print
> +  fi
>  fi
>  } | sort -f | $frcode > $LOCATE_DB.n


Reply to: