From owner-freebsd-ipfw@FreeBSD.ORG Fri Dec 10 00:33:54 2004 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 25F2416A4CE for ; Fri, 10 Dec 2004 00:33:54 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7B1443D69 for ; Fri, 10 Dec 2004 00:33:53 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id iBA0aeaO013187; Thu, 9 Dec 2004 16:36:40 -0800 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id iBA0aew9013186; Thu, 9 Dec 2004 16:36:40 -0800 Date: Thu, 9 Dec 2004 16:36:40 -0800 From: Brooks Davis To: Luigi Rizzo Message-ID: <20041210003640.GB8377@odin.ac.hmc.edu> References: <20041129192514.GA7331@odin.ac.hmc.edu> <20041130041932.B91746@xorpc.icir.org> <20041209150821.B5606@xorpc.icir.org> <20041210001958.GA8377@odin.ac.hmc.edu> <20041209162339.A6743@xorpc.icir.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mxv5cy4qt+RJ9ypb" Content-Disposition: inline In-Reply-To: <20041209162339.A6743@xorpc.icir.org> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu cc: Brooks Davis cc: ipfw@freebsd.org Subject: Re: strncmp usage in ipfw X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2004 00:33:54 -0000 --mxv5cy4qt+RJ9ypb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 09, 2004 at 04:23:39PM -0800, Luigi Rizzo wrote: > On Thu, Dec 09, 2004 at 04:19:58PM -0800, Brooks Davis wrote: > ... > > > i wonder if one couldn't temporarily replace strncmp with a wrapper t= hat > > > does behave as strncmp, but issues a warning in those cases where > > > the results would be ambiguous. > > > At least in this way one could tell if there is a problem > > > anywhere before removing it. > >=20 > > That would be easy enough. We could just ship 6.x that way and switch > > to only using explicit abbreviations in 7.x giving us a nice deprecation > > schedule without too much maintenance hassle. >=20 > i was actually thinking of putting the wrapper in 5.x as well > because there are no functional changes but the added bonus of > pointing out ambiguous and possibly unwanted behaviours Sounds reasionable. -- Brooks > luigi > > -- Brooks > >=20 > > > On Thu, Dec 09, 2004 at 01:53:19PM -0800, Brooks Davis wrote: > > > > On Tue, Nov 30, 2004 at 04:19:32AM -0800, Luigi Rizzo wrote: > > > > > i believe the original, old ipfw code used strncmp() to allow for > > > > > abbreviations. When i rewrote ipfw2 i did not feel like removing > > > > > the feature for fear of introducing backward compatibility proble= ms > > > > > with existing files. However I agree that this introduces a > > > > > maintainability nightmare and i believe we should move to strcmp(= ), > > > > > especially given that with ipfw2 new option names are coming out > > > > > quite frequently. > > > >=20 > > > > OK, that makes sense. > > > >=20 > > > > I'd like to propose the following plan: > > > >=20 > > > > - Disallow new strncmp instances in all branches. > > > >=20 > > > > - remove strncmp usage in HEAD with the intention of explicitly ad= ding > > > > back needed abbreviations when those abbreviations are both: > > > > - sane (no single letter appreviations, reasionable edit distan= ce > > > > from other options, either obvious shorthand or reasionbly mn= emonic). > > > > - actually used be someone (this is key, espeicaly since there = are > > > > hundreds of possiable values and this isn't a documented > > > > feature as far as I can tell.) > > > >=20 > > > > If need be we could implement a more complex stratigy for deprecati= on > > > > where we use a new matching function and warn about short matches, = but > > > > I'm not sure that's necessicary. > > > >=20 > > > > -- Brooks > > >=20 > > --=20 > > Any statement of the form "X is the one, true Y" is FALSE. > > PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 >=20 --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --mxv5cy4qt+RJ9ypb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBuO+XXY6L6fI4GtQRAvX/AKCMKyhK3XaCQVPn8bUfOUzYr7CJAwCg0zmH e02CHVb6scAAnmmN9XJ+HfI= =SD50 -----END PGP SIGNATURE----- --mxv5cy4qt+RJ9ypb--