Knob to turn off _POSIX_NO_TRUNC

Kostik Belousov kostikbel at gmail.com
Tue Apr 5 18:57:56 UTC 2011


On Tue, Apr 05, 2011 at 01:16:32PM -0400, John Baldwin wrote:
> On Tuesday, April 05, 2011 12:31:04 pm Gary Jennejohn wrote:
> > On Tue, 5 Apr 2011 18:40:02 +0300
> > Kostik Belousov <kostikbel at gmail.com> wrote:
> > 
> > > On Tue, Apr 05, 2011 at 05:27:46PM +0200, Gary Jennejohn wrote:
> > > > On Tue, 5 Apr 2011 17:16:31 +0300
> > > > Kostik Belousov <kostikbel at gmail.com> wrote:
> > > > > @@ -514,8 +519,14 @@ dirloop:
> > > > >  		continue;
> > > > >  	cnp->cn_namelen = cp - cnp->cn_nameptr;
> > > > >  	if (cnp->cn_namelen > NAME_MAX) {
> > > > > -		error = ENAMETOOLONG;
> > > > > -		goto bad;
> > > > > +		if (!lookup_trim) {
> > > > 
> > > > I would intuitively expect trimming to be enabled when the sysctl is set
> > > > to 1, but this is exactly the opposite of that.  I personally would
> > > > initialize it to 1.
> > > Trimming is indeed enabled when lookup_trim is set to 1.
> > > If lookup_trim is 0, you get ENAMETOOLONG.
> > 
> > OK, but trimming to me as a native english speaker means returning ENAMETOOLONG
> > rather than allowing names longer than NAME_MAX.  That is, after all, what trimming
> > means - cutting off.
> 
> Err, it shortens the name by chopping off the part beyond
> NAME_MAX ("trimming") when enabled. You could perhaps call it
> 'truncate_long_pathnames' instead of 'lookup_trim' if you wanted it to
> be very descriptive.
>
> Personally, I find this a bit hackish. You could always "fix" the 3rd
> party software by using LD_PRELOAD() to implement a wrapper around
> open() that trimmed the name if open() fails with ENAMETOOLONG.
Ok, I am taking the patch aside then. Please note that the change
as is allowed any vfs syscall taking the path, to proceed. Also,
the arbitrary path element, not only the last one, was handled.
But this is only a question of amount of code in the preloaded
library.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20110405/4810b1d0/attachment.pgp


More information about the freebsd-fs mailing list