From owner-freebsd-fs@FreeBSD.ORG Tue Apr 5 18:57:56 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 1375F106567A; Tue, 5 Apr 2011 18:57:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 65AB58FC12; Tue, 5 Apr 2011 18:57:54 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p35Ivpux083450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Apr 2011 21:57:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p35IvpwJ051522; Tue, 5 Apr 2011 21:57:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p35IvpMs051521; Tue, 5 Apr 2011 21:57:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 5 Apr 2011 21:57:51 +0300 From: Kostik Belousov To: John Baldwin Message-ID: <20110405185751.GE78089@deviant.kiev.zoral.com.ua> References: <20110405141631.GA78089@deviant.kiev.zoral.com.ua> <20110405154002.GD78089@deviant.kiev.zoral.com.ua> <20110405183104.2304d94e@ernst.jennejohn.org> <201104051316.32704.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="V5miJjP81WSXKLM2" Content-Disposition: inline In-Reply-To: <201104051316.32704.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-fs@freebsd.org 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 18:57:56 -0000 --V5miJjP81WSXKLM2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 wrote: > >=20 > > > 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 =3D cp - cnp->cn_nameptr; > > > > > if (cnp->cn_namelen > NAME_MAX) { > > > > > - error =3D ENAMETOOLONG; > > > > > - goto bad; > > > > > + if (!lookup_trim) { > > > >=20 > > > > I would intuitively expect trimming to be enabled when the sysctl i= s 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. > >=20 > > OK, but trimming to me as a native english speaker means returning ENAM= ETOOLONG > > rather than allowing names longer than NAME_MAX. That is, after all, w= hat trimming > > means - cutting off. >=20 > 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. --V5miJjP81WSXKLM2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk2bZi8ACgkQC3+MBN1Mb4iYrACeO6dDwg+u3yZJb07NXgOi+9OJ fv0AoMH11CKJ0RPUp6vmY5533M5MC9ax =vnqU -----END PGP SIGNATURE----- --V5miJjP81WSXKLM2--