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

Re: Proposal: plocate as standard for bookworm



On Mon, Feb 08, 2021 at 01:57:42PM -0800, Josh Triplett wrote:
> That doesn't make it usable for portable scripting. A script can't
> assume the presence of locate without declaring a dependency on it, and
> there's currently no virtual package for locate. And even if locate is
> present, a script can't assume that it'll return useful results, because
> it may not have an updated database, or even have a database initialized
> at all.

OK, but that's a very strict bar to set for to be useful for scripting.
locate is not a POSIX tool, and doesn't try to use be that either;
you wouldn't use it in an installer meant to run on foreign computers.
But in a controlled environment, you can build utility scripts around locate
-- and I know of several people that do.

> Statistics elsewhere in this thread suggest that it's not that cheap
> even on a fast system with an SSD. It's likely to be slower on systems
> with spinning disks. That's leaving aside the effect on caches.

Well, given that Paul didn't share the number of files on his system on-list,
I won't repeat it here; but let me suggest that it is way up on the
99-percentile of what I'd ever expect a desktop machine to have.
And yet, the cron job finishes in 40 seconds, during which the machine is
perfectly usable.

An interesting question is what _would_ be acceptable speed and resource use?

> What is the net benefit of having plocate installed by default (that
> isn't available by installing it)? What is the net drawback? Why does
> the former outweigh the latter?

Just like with any other package: It's more discoverable (how would any user
know that “apt install locate” is the locate you _least_ want?), and users on
shared systems can expect it to be available without asking an administrator
first. To me, locate has always been a standard tool on a UNIX system, so it
makes sense to install it by default.

The downside is, of course, the nightly updatedb job, which it is rare that
anyone will notice, and the space used. For my laptop, the latter is 19 MB;
for comparison, the systemd journal on the same machine (which is left on
buster defaults, and that I never use) is 2.8 GB :-)

> It's a database of files that previously existed on the system. If users
> are unaware of that database, it may leak information they did not
> expect. For instance, after deleting a file or unmounting a device, the
> locate database may still have a record of such files.

To address this specific issue: Once the file is gone, neither plocate nor
mlocate will show it anymore. If you are root, you can go into the database,
of course, but if so, you could also undelete files fairly reliably or just
stop it from being deleted in the first place.

/* Steinar */
-- 
Homepage: https://www.sesse.net/


Reply to: