From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 17:27:58 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9952B106566B for ; Wed, 18 Jun 2008 17:27:58 +0000 (UTC) (envelope-from cokane@freebsd.org) Received: from QMTA02.westchester.pa.mail.comcast.net (qmta02.westchester.pa.mail.comcast.net [76.96.62.24]) by mx1.freebsd.org (Postfix) with ESMTP id EF9998FC12 for ; Wed, 18 Jun 2008 17:27:57 +0000 (UTC) (envelope-from cokane@freebsd.org) Received: from OMTA05.westchester.pa.mail.comcast.net ([76.96.62.43]) by QMTA02.westchester.pa.mail.comcast.net with comcast id fQDS1Z0020vyq2s520Ts00; Wed, 18 Jun 2008 17:27:57 +0000 Received: from mail.cokane.org ([24.60.133.163]) by OMTA05.westchester.pa.mail.comcast.net with comcast id fVTn1Z0033Xh0XL3RVTnTi; Wed, 18 Jun 2008 17:27:48 +0000 X-Authority-Analysis: v=1.0 c=1 a=Ru4scuCtayUA:10 a=M7MWwdNnLy0A:10 a=bPvyiafqAAAA:8 a=X-L_QrUE3NKvll_17poA:9 a=STkbtjBPmoRBqeuyZaQA:7 a=6W0YUtuzFC50axuThV_ZIP73qRwA:4 a=rC2wZJ5BpNYA:10 a=LY0hPdMaydYA:10 a=DFRjGsB2qUzJbNiNIycA:9 a=xsGRsqNFfuFIIGTpLddIQAkzaCQA:4 a=rPt6xJ-oxjAA:10 Received: by mail.cokane.org (Postfix, from userid 103) id A144F35A7D5; Wed, 18 Jun 2008 13:27:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.1.8-gr1 (2007-02-13) on discordia X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8-gr1 Received: from [172.20.1.3] (erwin.int.cokane.org [172.20.1.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cokane.org (Postfix) with ESMTP id 884461DB2F9; Wed, 18 Jun 2008 13:27:25 -0400 (EDT) From: Coleman Kane To: Doug Barton In-Reply-To: <48593673.8030607@FreeBSD.org> References: <188001.76281.qm@web32705.mail.mud.yahoo.com> <48593673.8030607@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-WEHWmX0ohlt/WrLJpi3u" Organization: FreeBSD Project Date: Wed, 18 Jun 2008 13:25:34 -0400 Message-Id: <1213809934.68025.39.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port Cc: Diomidis Spinellis , pfgshield-freebsd@yahoo.com, Gabor Kovesdan , current@FreeBSD.org Subject: Re: CFT: BSD-licensed grep [Fwd: cvs commit: ports/textproc/bsdgrep Makefile distinfo] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2008 17:27:58 -0000 --=-WEHWmX0ohlt/WrLJpi3u Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 2008-06-18 at 09:23 -0700, Doug Barton wrote: > pfgshield-freebsd@yahoo.com wrote: > > On 2008-06-17, Gabor Kovesdan wrote: > >>> egrep: empty (sub)expression > >>>=20 > >> I've looked at this and I have a patch with a workaround:=20 > >> http://kovesdan.org/patches/grep.dougb.diff > >=20 > > This general behavior should be considered a GNUism, the type of > > thing that we want to avoid in scripts. Perhaps, if it's too > > common, the workaround should be ifdef'd into a GNU compatible mode > > or something. >=20 > No, "here is a new bsd grep, but change all your scripts that have=20 > relied on legitimate behavior of grep in the past" is a non-starter. I=20 > haven't checked POSIX to see whether the particular construction I am=20 > using fits the spec or not, but I really don't care. We need to be=20 > feature-compatible with the GNU versions of these tools, both for=20 > legacy scripts and also for those users migrating over from linux. >=20 > Doug >=20 I think that this is the second time that I've seen this type of issue come up (oh no! A GNU-ism sneaks in! Oh, the horror! The horror!). Seriously, I really see this attitude as counter-productive to getting wider acceptance of the project. I don't think FreeBSD's (or any BSD's) mission statement ever involved "ridding the *NIX world of the decidedly impure habits of the GNU system". I always thought it was more along the lines of "lets make an OS, that is better than the GNU system, and free-er too". The above statement, critical of GNU grep, does not offer any insight into what "the right way" (read: not the GNU way) is. Such "proclamations" are justifiably going to elicit the responses along the lines of Doug's response. Honestly, in this case you can either choose to pick up BSD grep yourself and do the work, or not drop in to chastise someone for mirroring a "GNU-ism" behavior. How about coming up with a script that parses all these "GNU-ism offenders" and corrects the GNU-isms into POSIX-compliant behavior?=20 =EF=BB=BF How about at least explaining what you think the proper way to do it using our grep should be? Here's my take on it: * We reject "||", "(|", and "|)" (via our regex lib) right now * GNU grep seems to interpret that as inclusive-or '' (which causes the OR to match an "empty string" for that field, and basically allow it to not exist and still match). * We want to remove the empty disjunction with this patch? The above seems to indicate that even the posted fix is not going to operate the same as it does under GNU... From a logical point-of-view, a disjunction that contains "empty" should match an empty, so in that sense the GNU grep behavior has a logical basis. For example, take five strings { "aba", "ab", "abc", "ac", "an" } The GNU pattern "^a(b|)c$" could match "abc" and "ac" because the "empty string was explicitly matched". The solution proposed, however, would only match "abc". Logically, there's a basis for performing the GNU method (even in my Automata course). So perhaps try explaining rather than shooting down. Just because GNU does it doesn't mean it should be immediately tossed out (and *must* be wrong). The people who develop Linux and the GNU tools generally are a perfectly competent and intelligent bunch, even though their ideology may differ. If that weren't the case, then we wouldn't be using their grep in our base system in the first place. If we want to remove the behavior from our system, we'll need to find all cases of (a|b||c) and convert them into (a|b|c){0,1} (if the latter is even possible on BSD grep). Only if the expression is (a|b||c)* can it safely become (a|b|c). --=20 Coleman Kane --=-WEHWmX0ohlt/WrLJpi3u Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkhZRPkACgkQcMSxQcXat5f6TACeMJGASG6KLi74V+ngmq+oYUm3 1ZgAnjSBNWanKDn5ZCI9GidZQEarNKfs =dOAQ -----END PGP SIGNATURE----- --=-WEHWmX0ohlt/WrLJpi3u--