File: updatedb

package info (click to toggle)
plocate 1.1.24-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 460 kB
  • sloc: cpp: 5,390; sh: 84; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /bin/sh
set -e

adduser --disabled-password --gecos testuser testuser

# /tmp (and tmpfs) is normally pruned out, and $AUTOPKGTEST_TMP lives there,
# so we need to fix that.
sed -i s/tmp/disabled_tmp/g /etc/updatedb.conf

# Before, we should not find anything (and the return value should
# reflect that).
updatedb.plocate 
! su testuser -c 'plocate PLOCATE_TEST_FILE'
! su testuser -c 'plocate PLOCATE_TEST_FILE' | grep -q PLOCATE_TEST_FILE

# Create one visible file, and one invisible file.
chmod o+rx $AUTOPKGTEST_TMP
touch $AUTOPKGTEST_TMP/PLOCATE_TEST_FILE
mkdir $AUTOPKGTEST_TMP/secret-dir
touch $AUTOPKGTEST_TMP/secret-dir/PLOCATE_INVISIBLE_TEST_FILE
chmod 0700 $AUTOPKGTEST_TMP/secret-dir

# Now run updatedb again.
updatedb.plocate 

# Now one file should be visible, and the other still invisible.
su testuser -c 'plocate PLOCATE_TEST_FILE' | grep -q PLOCATE_TEST_FILE
! su testuser -c 'plocate PLOCATE_INVISIBLE_TEST_FILE' | grep -q PLOCATE_INVISIBLE_TEST_FILE

# Make the test file visible, and we should see it at once.
chmod 0755 $AUTOPKGTEST_TMP/secret-dir
su testuser -c 'plocate PLOCATE_INVISIBLE_TEST_FILE' | grep -q PLOCATE_INVISIBLE_TEST_FILE

userdel testuser