Package: locate
Version: 4.10.0-3
Severity: wishlist
X-Debbugs-Cc: [email protected]

Dear Maintainer,

this is an RFE, actually ...

I am on a single-user system, and I want my locate database to contain
information even on those files that are not accessible to a
non-administrative user.  In other words, I'd like to call
`updatedb.findutils' and the dependent `find' as `root'.

The right approach to configure that seems setting `LOCALUSER' to the
empty string in `/etc/updatedb.findutils.cron.local'.  Because
`updatedb.findutils' handles an empty `LOCALUSER' explicitly by not
switching users:

,----
| if [ "$LOCALUSER" != "" ]; then
|   # : A1
|   su $LOCALUSER `select_shell $LOCALUSER` -c \
|   "$find $SEARCHPATHS $FINDOPTIONS [...]"
| else
|   # : A2
|   $find $SEARCHPATHS $FINDOPTIONS [...]
| fi
`----

In contrast to that, `/etc/cron.daily/locate' handles the case of an
empty `LOCALUSER' more or less by chance, since the `getent' call

,----
| if getent passwd $LOCALUSER > /dev/null ; then
|   cd / && nice -n ${NICE:-10} updatedb.findutils 2>/dev/null
| else
|   echo "User $LOCALUSER does not exist."
|   exit 1
| fi
`----

means "get all users" if unquoted `$LOCALUSER' expands to naught, which
results in a zero exit value.

Maybe the following would be a bit more expressive:

,----
| # check for an explictly empty LOCALUSER, which inhibits the user
| # switch otherwise done by updatedb.findutils
| if [ -z "$LOCALUSER" ] || getent passwd $LOCALUSER > /dev/null ; then
|   cd / && nice -n ${NICE:-10} updatedb.findutils 2>/dev/null
| else
|   echo "User $LOCALUSER does not exist."
|   exit 1
| fi
`----

Thanks for maintaining the locate package!

-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.16.12+deb14+1-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages locate depends on:
ii  findutils  4.10.0-3
ii  libc6      2.41-12

locate recommends no packages.

locate suggests no packages.

-- no debconf information

Reply via email to