Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 21:50:45 -0700 (PDT)
From:      Doug Barton <dougb@FreeBSD.org>
To:        Gabor Kovesdan <gabor@FreeBSD.org>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: [bsdgrep] grep -ql does not supress output
Message-ID:  <alpine.BSF.2.00.1007232143100.1697@qbhto.arg>
In-Reply-To: <4C4A6F00.9000203@FreeBSD.org>
References:  <alpine.BSF.2.00.1007232052210.1697@qbhto.arg> <4C4A6F00.9000203@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  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: <alpine.BSF.2.00.1007232145541.1697@qbhto.arg>

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 <foo>' 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: <alpine.BSF.2.00.1007232143570.1697@qbhto.arg>
Content-Description: 
Content-Disposition: attachment; filename=bsdgrep-ql.diff

SW5kZXg6IGdyZXAuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIGdy
ZXAuYwkocmV2aXNpb24gMjEwNDM4KQ0KKysrIGdyZXAuYwkod29ya2luZyBj
b3B5KQ0KQEAgLTQ2NiwxMSArNDY2LDExIEBADQogCQkJYnJlYWs7DQogCQlj
YXNlICdMJzoNCiAJCQlsZmxhZyA9IGZhbHNlOw0KLQkJCUxmbGFnID0gcWZs
YWcgPSB0cnVlOw0KKwkJCUxmbGFnID0gdHJ1ZTsNCiAJCQlicmVhazsNCiAJ
CWNhc2UgJ2wnOg0KIAkJCUxmbG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pbCAmJiBBZmxhZykNCiAJCQkJcHJp
bnRmKCItLVxuIik7DQo=

--0-1335630748-1279946638=:1697--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1007232143100.1697>