bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in grep regarding


From: Alain Magloire
Subject: Re: bug in grep regarding
Date: Sun, 29 Jul 2001 11:16:38 -0400 (EDT)

> 
> Bug report for GNU grep:
> 1. grep version number: 2.4.2
> 2. No patches made(used the binary)
> 3.  Machine type, OS etc: Redhat Linux 7.1, Pentium III 996Mhz single 
> processor, Linux kernel 2.4.4-2
> 4.  No compiling done, used binary directly
> 5. grep -E '[]mz]' test.c
> 
> where test.c was
> 
> int main()
> {
>    fprintf(stdout,"This [goes to standard out\n");
>    fprintf(stderr,"This ]goes to standard error\n");
>    fprintf(stderr,"This -goes to standard error\n");
>    fprintf(stderr,"This ^goes to standard error\n");
> }
> 
> OutPut seen:
> 
> int main()
> 
> Output expected:
> 
> int main()
>        fprintf(stderr,"This ]goes to standard error\n");
> 
> Problem Explanation: The Character ']' cannot be used inside a character 
> list. The GNU documentation says that to use this in  a character list, 
> put it in the beginning of the list. The same is the observation for '^' 
> character.(which the doc says should in anywhere but first)
> BTW, the same command works fine in solaris.
> 
> Please reply with resolution and comments if possible,

# uname -rs
Linux 2.2.5-15  
# cat test.c
int main()
{
   fprintf(stdout,"This [goes to standard out\n");
   fprintf(stderr,"This ]goes to standard error\n");
   fprintf(stderr,"This -goes to standard error\n");
   fprintf(stderr,"This ^goes to standard error\n");
}
# grep -E '[]mz]' test.c
int main()
   fprintf(stderr,"This ]goes to standard error\n");
# grep --version
grep (GNU grep) 2.4.2

Copyright 1988, 1992-1999, 2000 Free Software Foundation, Inc.
...

Seems to work fine here.

I had some reports about different behaviour according to the
locale(LANG environment variable).  But this usually happen when
specifying a range. 

In any case, I could not reproduce your behaviour on any of my
machines.

--
alain




reply via email to

[Prev in Thread] Current Thread [Next in Thread]