From owner-freebsd-fs@FreeBSD.ORG Tue Apr 5 17:16:34 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14F6F106566B for ; Tue, 5 Apr 2011 17:16:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DEF288FC0C for ; Tue, 5 Apr 2011 17:16:33 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 92DB146B06; Tue, 5 Apr 2011 13:16:33 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 311098A01B; Tue, 5 Apr 2011 13:16:33 -0400 (EDT) From: John Baldwin To: freebsd-fs@freebsd.org, gljennjohn@googlemail.com Date: Tue, 5 Apr 2011 13:16:32 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110325; KDE/4.5.5; amd64; ; ) References: <20110405141631.GA78089@deviant.kiev.zoral.com.ua> <20110405154002.GD78089@deviant.kiev.zoral.com.ua> <20110405183104.2304d94e@ernst.jennejohn.org> In-Reply-To: <20110405183104.2304d94e@ernst.jennejohn.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201104051316.32704.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 05 Apr 2011 13:16:33 -0400 (EDT) Cc: Subject: Re: Knob to turn off _POSIX_NO_TRUNC X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2011 17:16:34 -0000 On Tuesday, April 05, 2011 12:31:04 pm Gary Jennejohn wrote: > On Tue, 5 Apr 2011 18:40:02 +0300 > Kostik Belousov 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 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. -- John Baldwin