From owner-freebsd-current@FreeBSD.ORG Sat Jul 24 04:50:49 2010 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A20FD1065675 for ; Sat, 24 Jul 2010 04:50:49 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 447608FC14 for ; Sat, 24 Jul 2010 04:50:48 +0000 (UTC) Received: (qmail 21804 invoked by uid 399); 24 Jul 2010 04:50:48 -0000 Received: from localhost (HELO laptop.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 24 Jul 2010 04:50:48 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Date: Fri, 23 Jul 2010 21:50:45 -0700 (PDT) From: Doug Barton To: Gabor Kovesdan In-Reply-To: <4C4A6F00.9000203@FreeBSD.org> Message-ID: References: <4C4A6F00.9000203@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-message-flag: Outlook -- Not just for spreading viruses anymore! OpenPGP: id=1A1ABC84 Organization: http://SupersetSolutions.com/ MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; boundary="0-1335630748-1279946638=:1697" Content-ID: Cc: freebsd-current@FreeBSD.org Subject: Re: [bsdgrep] grep -ql does not supress output 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: Sat, 24 Jul 2010 04:50:49 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1335630748-1279946638=:1697 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-ID: On Sat, 24 Jul 2010, Gabor Kovesdan wrote: > Em 2010.07.24. 6:19, Doug Barton escreveu: >> There are several places in portmaster where I use '[e]grep -ql ' to >> signal existence of something without having to deal with the output of >> grep. In oldgrep this worked as advertised. In bsdgrep it doesn't. >> >> Furthermore, looking at the code it doesn't seem like it's a trivial fix >> since you seem to be conflating the idea of -q with "don't output the >> matching lines" instead of "don't output anything" which is what the old >> one did: >> >> case 'l': >> Lflag = false; >> lflag = qflag = true; >> break; >> >> Also, looking at the code it's not clear to me that the -q option has its >> previous behavior of halting processing for that file on the first match, >> but I've only given it a quick look. >> >> So, request number 1, fix it so that bsdgrep -ql doesn't output anything, >> and make sure that -q actually halts processing on the first match. > > Of course both this and the color issue will be fixed. Thanks. I took another look at it, and I think the attached patch does the trick, although you'll probably want to regression test it. I'm running some limited tests now as well. I still haven't verified that -q halts processing on the first match however. >> Request number 2, think about whether or not introducing this as the >> default was the right course of action. I held my tongue on this when you >> committed it, but in the past when such things have been added they start >> life as an option, allowing those who choose to do so to regression test >> them. Once they've had a shakeout period THEN the switch is flipped to make >> them the default. I'm not at the point yet where I'm ready to ask for you >> to change this, but between the color thing and this issue, that ball has >> started to roll, in my mind at least. We'll see what happens with more >> testing. > > This change was thoroughly tested on pointyhat and by several interested > people even by you. Actually, the compatibility for non-standard GNU regexes > were added when you requested it after trying out with portmaster. Yes, IIRC that was when I last tested it for you about 2 years ago. And I appreciate you adding that support. > Why didn't you tell me earlier about this bug then, as well? My fuzzy recollection is that the various micro-optimizations such as this one have been added to portmaster in the intervening 2 years, but I could be wrong. If the bug and my code were both there 2 years ago, please accept my apologies for not reporting it sooner. Meanwhile, pointyhat runs are great for trying to assess bare technical compatibility with known combinations of options; however as I've learned in trying to regression-test portmaster, real human users are roughly infinitely more creative than that. :) hth, Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso --0-1335630748-1279946638=:1697 Content-Type: TEXT/PLAIN; charset=us-ascii; name=bsdgrep-ql.diff Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=bsdgrep-ql.diff SW5kZXg6IGdyZXAuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGdy ZXAuYwkocmV2aXNpb24gMjEwNDM4KQ0KKysrIGdyZXAuYwkod29ya2luZyBj b3B5KQ0KQEAgLTQ2NiwxMSArNDY2LDExIEBADQogCQkJYnJlYWs7DQogCQlj YXNlICdMJzoNCiAJCQlsZmxhZyA9IGZhbHNlOw0KLQkJCUxmbGFnID0gcWZs YWcgPSB0cnVlOw0KKwkJCUxmbGFnID0gdHJ1ZTsNCiAJCQlicmVhazsNCiAJ CWNhc2UgJ2wnOg0KIAkJCUxmbGFnID0gZmFsc2U7DQotCQkJbGZsYWcgPSBx ZmxhZyA9IHRydWU7DQorCQkJbGZsYWcgPSB0cnVlOw0KIAkJCWJyZWFrOw0K IAkJY2FzZSAnbSc6DQogCQkJbWZsYWcgPSB0cnVlOw0KSW5kZXg6IHV0aWwu Yw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIHV0aWwuYwkocmV2aXNp b24gMjEwNDM4KQ0KKysrIHV0aWwuYwkod29ya2luZyBjb3B5KQ0KQEAgLTIy Niw5ICsyMjYsOSBAQA0KIAkJCXByaW50ZigiJXM6IiwgbG4uZmlsZSk7DQog CQlwcmludGYoIiV1XG4iLCBjKTsNCiAJfQ0KLQlpZiAobGZsYWcgJiYgYyAh PSAwKQ0KKwlpZiAobGZsYWcgJiYgIXFmbGFnICYmIGMgIT0gMCkNCiAJCXBy aW50ZigiJXNcbiIsIGZuKTsNCi0JaWYgKExmbGFnICYmIGMgPT0gMCkNCisJ aWYgKExmbGFnICYmICFxZmxhZyAmJiBjID09IDApDQogCQlwcmludGYoIiVz XG4iLCBmbik7DQogCWlmIChjICYmICFjZmxhZyAmJiAhbGZsYWcgJiYgIUxm bGFnICYmDQogCSAgICBiaW5iZWhhdmUgPT0gQklORklMRV9CSU4gJiYgZi0+ YmluYXJ5ICYmICFxZmxhZykNCkBAIC0zNDIsNyArMzQyLDcgQEANCiAJCXJl dHVybiAoYyk7IC8qIEJpbmFyeSBmaWxlICovDQogDQogCS8qIERlYWxpbmcg d2l0aCB0aGUgY29udGV4dCAqLw0KLQlpZiAoKHRhaWwgfHwgYykgJiYgIWNm bGFnICYmICFxZmxhZykgew0KKwlpZiAoKHRhaWwgfHwgYykgJiYgIWNmbGFn ICYmICFxZmxhZyAmJiAhbGZsYWcpIHsNCiAJCWlmIChjKSB7DQogCQkJaWYg KCFmaXJzdCAmJiAhcHJldiAmJiAhdGFpbCAmJiBBZmxhZykNCiAJCQkJcHJp bnRmKCItLVxuIik7DQo= --0-1335630748-1279946638=:1697--