From owner-freebsd-ipfw@FreeBSD.ORG Thu Dec 9 23:08:25 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 E2E4116A4CE for ; Thu, 9 Dec 2004 23:08:25 +0000 (GMT) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id C0DF043D5C for ; Thu, 9 Dec 2004 23:08:25 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.8) with ESMTP id iB9N8PLj006089; Thu, 9 Dec 2004 15:08:25 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id iB9N8LNw006088; Thu, 9 Dec 2004 15:08:21 -0800 (PST) (envelope-from rizzo) Date: Thu, 9 Dec 2004 15:08:21 -0800 From: Luigi Rizzo To: Brooks Davis Message-ID: <20041209150821.B5606@xorpc.icir.org> References: <20041129192514.GA7331@odin.ac.hmc.edu> <20041130041932.B91746@xorpc.icir.org> <20041209215319.GA12303@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20041209215319.GA12303@odin.ac.hmc.edu>; from brooks@one-eyed-alien.net on Thu, Dec 09, 2004 at 01:53:19PM -0800 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: Thu, 09 Dec 2004 23:08:26 -0000 the plan is fine with me. i wonder if one couldn't temporarily replace strncmp with a wrapper that 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. cheers luigi 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 problems > > 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. > > OK, that makes sense. > > I'd like to propose the following plan: > > - Disallow new strncmp instances in all branches. > > - remove strncmp usage in HEAD with the intention of explicitly adding > back needed abbreviations when those abbreviations are both: > - sane (no single letter appreviations, reasionable edit distance > from other options, either obvious shorthand or reasionbly mnemonic). > - 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.) > > If need be we could implement a more complex stratigy for deprecation > where we use a new matching function and warn about short matches, but > I'm not sure that's necessicary. > > -- Brooks