A problem with MAXPATHLEN on a back

Willem Jan Withagen wjw at digiware.nl
Fri Jun 15 21:09:17 UTC 2012


On 2012-03-03 17:37, Jilles Tjoelker wrote:
> On Sun, Feb 26, 2012 at 02:40:09PM +0100, Willem Jan Withagen wrote:
>> I'm running into this on a backup-backupserver.
>> (8.2-STABLE #134: Wed Feb  1 15:05:59 CET 2012 amd64)
> 
>> Haven't checked which paths are too long.
>> But is there any "easy" way out? Like making MAXPATHLEN 2048 and
>> rebuilding locate.
>> Or is that going to propagate and major impact all and everything.
> 
>> Rebuilding locate database:
>> locate: integer out of +-MAXPATHLEN (1024): 1031
>> locate: integer out of +-MAXPATHLEN (1024): 1031
> 
> It should be possible to replace (sed -i) MAXPATHLEN with something else
> in the locate source and recompile it. Changing the value of MAXPATHLEN
> itself is not safe because it defines the size of various buffers in the
> ABI (such as the one passed to realpath() if its resolved_path parameter
> is not NULL); in any case, it is a very intrusive change.

Right, this changing the ABI.
But I was thinking more along the line to have userspace at least
allocate more, so long(er) paths in ZFS would still work.

> Locate uses find(1) to generate its list of files, and find's output is
> not subject to MAXPATHLEN (unless the -L option or the -follow primary
> is used). Almost any use of the very long pathnames will require a
> manual split-up though (cd'ing to an initial part shorter than
> MAXPATHLEN, then repeating the process with relative pathnames until the
> remaining part is shorter than MAXPATHLEN).

I finally came around to trying something to fix this.
And my problem is with the files stored on ZFS on my backupserver. There
that path are apparently rather long in the Windows-backups made there.

But it messes up the complete locate.

So I went into
	/usr/src/src8/src/usr.bin/locate/locate/locate.h
And (un|re)defined MAXPATHLEN to mean 2048 in stead of 1024.

That fixed my problem. Not shure if that would be a general fix.
But it would be able that more tools would run into these types of problems.

Maybe userspace MAXPATHLEN should be set to something bigger to start
with... But I'll leave that to people with more experience.

--WjW





More information about the freebsd-stable mailing list