aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/locate
Commit message (Collapse)AuthorAgeFilesLines
* locate.updatedb: Revert to using cat to copy the db.Dag-Erling Smørgrav2024-10-021-1/+1
| | | | | | | | | | | | | This script is usually run unprivileged, so install fails to create a temporary file while copying the finished database. Revert to using cat, which can overwrite the existing file as it is usually owned by the same user which is running the script. Fixes: f62c1f3f8e91 MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D46872
* locate.updatedb: Explicitly exit from trap code.Dag-Erling Smørgrav2024-08-291-8/+5
| | | | | | | | | | | | | | | | | | | | When a signal is trapped, the script continues after the trap code has run, unless the trap code explicitly exits. In the particular case of locate.updatedb, this is mostly harmless, except that the trap code is executed twice (once for the signal and once when we reach the end of the script), but it's still worth fixing. Furthermore, install the trap as soon as we've created the temporary directory, to minimize the window during which we can fail to clean up after ourselves if interrupted. While here, simplify the empty check at the end and make some minor style tweaks. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D46475
* Remove residual blank line at start of MakefileWarner Losh2024-07-155-5/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* Remove remnants of portsnap(8)Olivier Certner2024-04-302-2/+2
| | | | | | | | | | | | | | | | | | | This was prompted by noticing that '/var/db/portsnap' still exists on newly-installed machines. With this change, all mentions of portsnap(8) in the tree are gone, except for the historical note in the AUTHORS section of manpage phttpget(8). locate(1) will thus start indexing again '/var/db/portsnap' on machines where this directory still exists, which may be a good way to push administrators to delete it. Reviewed by: cperciva Approved by: emaste (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45023
* Remove copyright strings ifdef'd outWarner Losh2023-11-273-29/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-2710-19/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Purge more stray embedded $FreeBSD$ stringsJohn Baldwin2023-09-251-2/+0
| | | | | | | These do not use __FBSDID but instead use bare char arrays. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41957
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-1612-12/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-164-8/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-123-3/+3
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-193-3/+1
|
* locate: Use C89 function definitions.John Baldwin2023-04-182-22/+8
| | | | | Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D39526
* improve c styleWolfram Schneider2022-02-142-14/+11
| | | | | | | | - BSD KNF: return is a native statement and we use a space before the parenthesis - remove superfluous empty lines Reported by: jrtc27
* grammarWolfram Schneider2022-02-141-2/+2
| | | | Reported by: jrtc27
* Better help message if locate database does not existsWolfram Schneider2022-02-132-10/+62
| | | | | | | PR: 211501 Reported by: Oliver Peter Reviewed by: Pau Amma Differential Revision: https://reviews.freebsd.org/D34243
* switch from short to int for lookup tableWolfram Schneider2022-02-051-5/+4
| | | | This simplifies the code, less casting is needed.
* remove dead codeWolfram Schneider2022-02-031-35/+2
| | | | | A lookup array is faster than a function with linear search. The old function was not used for years - spring cleaning.
* better printf(3) format usageWolfram Schneider2022-02-031-1/+1
| | | | Reported by: jhb
* improve casting for pointer diffsWolfram Schneider2022-02-011-1/+1
|
* fix casting issue in error message for 32bit CPUs (e.g. armv7)Wolfram Schneider2022-01-311-1/+1
|
* cleanup documentationWolfram Schneider2022-01-311-7/+2
|
* throw an error if reading from stdin failedWolfram Schneider2022-01-311-0/+3
|
* enable to configure the locate path length at compile timeWolfram Schneider2022-01-315-19/+23
| | | | | | | The length has not changed and is 1024 chars (equals PATH_MAX). PR: 201243 Submitted by: Willem Jan Withagen <wjw@digiware.nl>
* Fix statistics for empty databasesWolfram Schneider2022-01-311-7/+9
| | | | | | | An empty database is a database which does not contain any filenames. It should not occur in practice but maybe in the case of an error. echo | /usr/libexec/locate.mklocatedb > empty.db; locate -d empty.db -S
* remove registerWolfram Schneider2022-01-313-9/+9
| | | | There are no measurable performance differences if registers are used or not.
* improve error handling for corrupt databaseWolfram Schneider2022-01-301-6/+17
|
* fix check for integerWolfram Schneider2022-01-301-8/+14
| | | | | | | | For historical reasons, the integer is stored with an offset of plus 14. That means, for a given max path length of 1024 the valid values are -1009 .. 1037 and not -1023 .. 1023 PR: 201243
* enable to set locate commandWolfram Schneider2022-01-301-2/+3
|
* fix fgets error handling (from last commit)Wolfram Schneider2022-01-301-2/+4
|
* improve error handlingWolfram Schneider2022-01-301-2/+5
|
* locate statistics: show number of longest path in databaseWolfram Schneider2022-01-291-2/+5
|
* sync improvements from concatdb.shWolfram Schneider2022-01-291-35/+20
| | | | | | | | - stop on first error - improve awk script: print the last two characters for bigram - not the second word - remove unnecessary checks - use mktemp - refactor
* limit sort(1) memory usage to 20% of available main memoryWolfram Schneider2022-01-261-1/+1
| | | | | | | | | | | | | By default BSD sort(1) uses 90% (or at least 50%?) of the available main memory. That is good for performance for a single job, but not for a shared OS. For a long running script the performance is less important than the stability of the server. Also, if a server with 64GB RAM starts swapping, the performance goes south and hurts other running applications. Note: this change does not affect the weekly cron job to rebuild the locate database. The FreeBSD locate.updatedb use the -presort option (find -s)
* support more than 2 billion file names for counting (-c) or limits (-l limit)Wolfram Schneider2022-01-263-16/+8
| | | | | - this fix (harmless) integer overflows for very large partitions (>1PB) - code cleanup
* switch to 64 bit integers for counting bigramsWolfram Schneider2022-01-261-3/+3
| | | | | | This fixes an integer overflow for very large partitions around 35 billion filenames (>2PB). However, in an artificially worst case it may occurs by only 17 mio filenames on a partition.
* locate statistics: non zero exit on corrupt databaseWolfram Schneider2022-01-251-0/+5
|
* stop on error and display the statstics anywayWolfram Schneider2022-01-251-0/+6
| | | | PR: 32686
* locate: change from BSD-4-clause to BSD-3-clauseBaptiste Daroussin2022-01-257-42/+14
| | | | | | | | | We have the authorization from the University of California to remove the advertising clause for a while, wosch@ who also hold a copyright on this code also approved the relicensing Approved by: wosch@ MFC after: 3 days
* refactor scriptWolfram Schneider2022-01-241-13/+8
| | | | | | - simpler usage of mktemp(1) - remove unnecessary checks - documentation
* awk: print the last two characters for bigram - not the second wordWolfram Schneider2022-01-241-1/+2
| | | | A bigram may contain a space character, and we always need two characters.
* stop on first errorWolfram Schneider2022-01-241-1/+5
|
* remove debug code for cpu usageWolfram Schneider2022-01-202-36/+1
| | | | | I guess nobody used this in the last decade, and you can get similar results with the time(1) command.
* Use 64-bit integers for database statisticsWolfram Schneider2022-01-201-8/+8
| | | | | | This fix (harmless) integer overflows for larger partitions (>2TB) PR: 223023
* correct type of mmap len parameterWolfram Schneider2022-01-192-7/+7
| | | | | | Using locate -m on a database > 2GB should work now. PR: 261277
* Fix a grammar error on locate(1).Guangyuan Yang2020-12-111-4/+3
| | | | | | | | | | | While here, also fix a useless .Tn reported by mandoc. PR: 251746 MFC after: 1 week Sumbitted by: David Schlachter <fbsd-bugzilla@schlachter.ca> Notes: svn path=/head/; revision=368550
* locate: fix -fno-common buildKyle Evans2020-03-292-1/+2
| | | | | | | | | | | | Just a single variable declaration to extern and define elsewhere here, myctype. -fno-common will become a default in GCC10/LLVM11. MFC after: 3 days Notes: svn path=/head/; revision=359425
* Move install of locate.rc to usr.bin/locate/locate/Brad Davis2018-09-181-4/+1
| | | | | | | | | | This leverages CONFS to handle the install and purges an old comment. Approved by: re (blanket, pkgbase), bapt (mentor) Differential Revision: https://reviews.freebsd.org/D17215 Notes: svn path=/head/; revision=338758