Bug in egrep?

2006-09-07 Thread Martin Marusak
OpenBSD egrep finds nothing in any text:
---
% echo some text here | egrep -x  ; echo $status
some text here
0
---

GNU grep does not:
---
% echo some text here | gegrep -x  ; echo $status
1
---
Isn't that a bug in OpenBSD egrep?

M.



Re: Bug in egrep?

2006-09-07 Thread Andrés

egrep shouldn't find anything, you are searching for the string  in
some text here, clearly, it isn't there.

On 9/7/06, Martin Marusak [EMAIL PROTECTED] wrote:

OpenBSD egrep finds nothing in any text:
---
% echo some text here | egrep -x  ; echo $status
some text here
0
---

GNU grep does not:
---
% echo some text here | gegrep -x  ; echo $status
1
---
Isn't that a bug in OpenBSD egrep?

M.





--
AndrC)s Delfino



Re: Bug in egrep?

2006-09-07 Thread Otto Moerbeek
On Thu, 7 Sep 2006, AndrC)s wrote:

 egrep shouldn't find anything, you are searching for the string  in
 some text here, clearly, it isn't there.

Nah, an empty search pattern should match any line, as defined by SU
and the man page. The only problem is if the -x option takes
precendence or not. SU does not say a word about that.

If anybody has access to a Solaris machine, I like to know what the
test does there.

-Otto


 On 9/7/06, Martin Marusak [EMAIL PROTECTED] wrote:
  OpenBSD egrep finds nothing in any text:
  ---
  % echo some text here | egrep -x  ; echo $status
  some text here
  0
  ---
 
  GNU grep does not:
  ---
  % echo some text here | gegrep -x  ; echo $status
  1
  ---
  Isn't that a bug in OpenBSD egrep?
 
  M.
 
 


 --
 AndrC)s Delfino



Re: Bug in egrep?

2006-09-07 Thread Claus Assmann
On Thu, Sep 07, 2006, Otto Moerbeek wrote:

 If anybody has access to a Solaris machine, I like to know what the
 test does there.

$ uname -a
SunOS mine 5.9 Generic_118558-11 sun4u sparc SUNW,Ultra-2
$ echo some text here | /usr/bin/egrep -x  ; echo $? 
/usr/bin/egrep: illegal option -- x
usage: egrep [ -bchilnsv ] [ -e exp ] [ -f file ] [ strings ] [ file ] ...
2
$ echo some text here | /usr/xpg4/bin/egrep -x  ; echo $? 
1



Re: Bug in egrep?

2006-09-07 Thread ddp
On 9/7/06, Otto Moerbeek [EMAIL PROTECTED] wrote:

 On Thu, 7 Sep 2006, AndrC)s wrote:

  egrep shouldn't find anything, you are searching for the string  in
  some text here, clearly, it isn't there.

 Nah, an empty search pattern should match any line, as defined by SU
 and the man page. The only problem is if the -x option takes
 precendence or not. SU does not say a word about that.

 If anybody has access to a Solaris machine, I like to know what the
 test does there.

 -Otto


 The following option is  supported  for  /usr/xpg4/bin/egrep
 only:

 -xConsider only input lines that use all  characters  in
   the  line  to  match an entire fixed string or regular
   expression to be matching lines.

$ alias egrep=/usr/xpg4/bin/egrep
$ echo some text here | egrep -x  ; echo $status

$

SunOS 5.9.

ddp



Re: Bug in egrep?

2006-09-07 Thread Otto Moerbeek
On Thu, 7 Sep 2006, Loic Tortay wrote:

 On 07/09/06, Otto Moerbeek [EMAIL PROTECTED] wrote:
 
  
  If anybody has access to a Solaris machine, I like to know what the
  test does there.
  
  On Solaris 8, 9 and 10 machines, the test gives the same result:
  % echo some text here | /usr/xpg4/bin/egrep -x  ; echo $status
  1
  %

OK, thanks

Try this.

-Otto

Index: grep.c
===
RCS file: /cvs/src/usr.bin/grep/grep.c,v
retrieving revision 1.35
diff -u -p -r1.35 grep.c
--- grep.c  7 Mar 2006 20:59:56 -   1.35
+++ grep.c  7 Sep 2006 15:47:04 -
@@ -168,7 +168,7 @@ struct option long_options[] =
 static void
 add_pattern(char *pat, size_t len)
 {
-   if (len == 0 || matchall) {
+   if (!xflag  (len == 0 || matchall)) {
matchall = 1;
return;
}



Re: Bug in egrep?

2006-09-07 Thread Otto Moerbeek
On Thu, 7 Sep 2006, Otto Moerbeek wrote:

 On Thu, 7 Sep 2006, AndrC)s wrote:
 
  egrep shouldn't find anything, you are searching for the string  in
  some text here, clearly, it isn't there.
 
 Nah, an empty search pattern should match any line, as defined by SU
 and the man page. The only problem is if the -x option takes
 precendence or not. SU does not say a word about that.
 
 If anybody has access to a Solaris machine, I like to know what the
 test does there.

For (k)sh, change $status into $?

 
   -Otto
 
 
  On 9/7/06, Martin Marusak [EMAIL PROTECTED] wrote:
   OpenBSD egrep finds nothing in any text:
   ---
   % echo some text here | egrep -x  ; echo $status
   some text here
   0
   ---
  
   GNU grep does not:
   ---
   % echo some text here | gegrep -x  ; echo $status
   1
   ---
   Isn't that a bug in OpenBSD egrep?
  
   M.
  
  
 
 
  --
  AndrC)s Delfino



Re: Bug in egrep?

2006-09-07 Thread Loic Tortay
On 07/09/06, Otto Moerbeek [EMAIL PROTECTED] wrote:


 If anybody has access to a Solaris machine, I like to know what the
 test does there.

 On Solaris 8, 9 and 10 machines, the test gives the same result:
  % echo some text here | /usr/xpg4/bin/egrep -x  ; echo $status
  1
  %


Looc.



Re: Bug in egrep?

2006-09-07 Thread Adam PAPAI

Otto Moerbeek wrote:

On Thu, 7 Sep 2006, AndrC)s wrote:


egrep shouldn't find anything, you are searching for the string  in
some text here, clearly, it isn't there.


Nah, an empty search pattern should match any line, as defined by SU
and the man page. The only problem is if the -x option takes
precendence or not. SU does not say a word about that.

If anybody has access to a Solaris machine, I like to know what the
test does there.


But the other grep in the Solaris says:

cnoc[spsy] echo some text here | /usr/xpg4/bin/egrep -x ; echo $status

cnoc[spsy]

So nothing.

--
Adam PAPAI
D i g i t a l Influence
http://www.digitalinfluence.hu
E-mail: [EMAIL PROTECTED]
Phone: +36 30 33-55-735 (Hungary)
Phone: +49 176-67264167 (Germany)



Re: Bug in egrep?

2006-09-07 Thread Mark Zimmerman
On Thu, Sep 07, 2006 at 05:44:40PM +0200, Otto Moerbeek wrote:
 On Thu, 7 Sep 2006, AndrC)s wrote:
 
  egrep shouldn't find anything, you are searching for the string  in
  some text here, clearly, it isn't there.
 
 Nah, an empty search pattern should match any line, as defined by SU
 and the man page. The only problem is if the -x option takes
 precendence or not. SU does not say a word about that.
 
 If anybody has access to a Solaris machine, I like to know what the
 test does there.
 
   -Otto
 
 
  On 9/7/06, Martin Marusak [EMAIL PROTECTED] wrote:
   OpenBSD egrep finds nothing in any text:
   ---
   % echo some text here | egrep -x  ; echo $status
   some text here
   0
   ---
  
   GNU grep does not:
   ---
   % echo some text here | gegrep -x  ; echo $status
   1
   ---
   Isn't that a bug in OpenBSD egrep?
  
   M.
  
  
 
 
  --
  AndrC)s Delfino
 

Sun Microsystems Inc.   SunOS 5.9   Generic May 2002

taz$ echo some text here | egrep -x  ; echo $status
egrep: illegal option -- x
usage: egrep [ -bchilnsv ] [ -e exp ] [ -f file ] [ strings ] [ file ]
...

taz$ echo some text here | egrep  ; echo $status
egrep: syntax error

taz$ 



Re: Bug in egrep?

2006-09-07 Thread Adam PAPAI

Otto Moerbeek wrote:

On Thu, 7 Sep 2006, AndrC)s wrote:


egrep shouldn't find anything, you are searching for the string  in
some text here, clearly, it isn't there.


Nah, an empty search pattern should match any line, as defined by SU
and the man page. The only problem is if the -x option takes
precendence or not. SU does not say a word about that.

If anybody has access to a Solaris machine, I like to know what the
test does there.


cnoc[spsy] uname -a
SunOS cnoc 5.8 Generic_117350-20 sun4u sparc SUNW,Sun-Blade-1500
cnoc[spsy] echo some text here | egrep -x  ; echo $status
egrep: illegal option -- x
usage: egrep [ -bchilnsv ] [ -e exp ] [ -f file ] [ strings ] [ file ] ...
cnoc[spsy]

No -x option.

--
Adam PAPAI
D i g i t a l Influence
http://www.digitalinfluence.hu
E-mail: [EMAIL PROTECTED]
Phone: +36 30 33-55-735 (Hungary)
Phone: +49 176-67264167 (Germany)



Re: Bug in egrep?

2006-09-07 Thread Stefan
On Thu, Sep 07, 2006, Otto Moerbeek wrote:

 If anybody has access to a Solaris machine, I like to know what the 
 test does there.


There's 2 different egreps on solaris. I had to give the full path to the
one that supported the -x option. Granted this isn't the most up to date
SunOS:

% uname -a
SunOS cluster1 5.8 Generic_117350-02 sun4u sparc SUNW,Ultra-2
% echo some text here | /usr/xpg4/bin/egrep -x  ; echo $status
1
% echo some text here | gegrep -x  ; echo $status
1



Re: Bug in egrep?

2006-09-07 Thread Oliver J. Morais
* Otto Moerbeek [EMAIL PROTECTED] [060907 17:44]:
 If anybody has access to a Solaris machine, I like to know what the
 test does there.

SunOS XX 5.9 Generic_118558-17 sun4u sparc SUNW,Sun-Fire-V240

#  echo some text here | egrep -x  ; echo $?
egrep: illegal option -- x
usage: egrep [ -bchilnsv ] [ -e exp ] [ -f file ] [ strings ] [ file ] ...
2

#  echo some text here | /usr/xpg4/bin/egrep -x  ; echo $?
1