SonicChicken

A bumbling foray into tumblr...


Rebuilding locate(1) database failing

Got an error on one of my FreeBSD systems a few days ago:

locate: integer out of +-MAXPATHLEN (1024): 1036

Overly long paths somewhere on my system. Unfortunately, locate.updatedb doesn’t seem to have any way of indicating which directory path is causing the problem. So the first step — figure out where the long paths are in the file system:

find -L / | awk '{ a=length; print a, $0}' | sort -nr | less

The longest paths on the system will be at the top of the list. None of them were anywhere near 1024 characters long, but all the longest paths were within one of my users’ svn working copies. I added that WC path to PRUNEPATHS in /etc/locate.rc:

PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap /path/to/working_copy"

(And uncommented the PRUNEPATHS setting, since I changed it from the default.) I manually ran the periodic(8) weekly script, without error. So I’m pretty sure I’ve fixed the problem, although I would like to know why the “long” path length is so much shorter than the published limit.

Actually, what I would really like would be for locate.updatedb to include the long pathname(s) in its error message!

Hat tip to Lowell Gilbert for this post!

Notes

  1. sonicchicken posted this