On Sat, Oct 30, 2021 at 06:33:38PM +0800, Paul Wise wrote: > When a directory has been deleted, plocate only shows the directory > name, but not any of the files that were in the directory.
Nor any of the directories that were in that directory. You only get one level deep (and only if you have access to seeing it). > For situations where a directory was accidentally deleted it would be > helpful to be able to list the files that used to be in that directory > to find out what data was lost and needs to be restored from backup, to > avoid restoring far too much from backup, which usually takes much > longer. The plocate database has that information, but plocate does a > stat and only lists files that still exist. I was able to achieve the > result I'm looking for by making the stat_if_needed function return > true, but I think it would be faster to have a codepath that doesn't > call this function when the proposed option is enabled. We really can't do this without dropping sgid, though; that would be a security hole. If a file you didn't have access to earlier was deleted, locate shouldn't suddenly be able to find it. > PS: the -e/--existing flag doesn't appear to do anything, looking at > the source code it only toggles a bool, which nothing looks at. Really? stat_if_needed() checks it, and it seems to work just fine for me: kos:~> touch bug998118-test-file kos:~> sudo updatedb kos:~> rm bug998118-test-file kos:~> locate bug998118 /home/sesse/bug998118-test-file kos:~> locate -e bug998118 kos:~> /* Steinar */