Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Bug in QNX4 grep?: (8 Items)
   
Bug in QNX4 grep?  
I'm trying to build a package on QNX4 using the configure script built with autoconf 2.65 but it fails. I've tracked it 
down to what appears to be a bug in the QNX supplied grep.

The command that is failing is effectively:

grep -c '$'

This is supposed to count the number of end-of-lines in the input stream but always returns 0.

An example of usage:

cat /etc/hosts | grep -c '$'

will return 0 on QNX4, but works fine on Linux.

cat /etc/hosts | grep -c '^'

successfully returns the number of start-of-lines on QNX4 and Linux, so I conclude that there is a bug in the supplied 
grep.

As the use of grep -c '$' is embedded in the generated configure script I can change the configure script but that's not
 an ideal solution. It will affect every other source package distributed that uses autoconf, not just the ones that I 
maintain.

Is there any chance that this bug in grep could be rectified? (This is the most effective solution)
Is there a port of GNU grep for QNX4? (This is also not ideal as it would require installation of another package)
I will try and see if the autoconf maintainers will make a change to work around this bug.

Thanks for reading this far.
Mark
Re: Bug in QNX4 grep?  
I think, it is just due to bash which interprets $. use

grep -c '\$'
Re: Bug in QNX4 grep?  
sorry not bash, but ksh
Re: Bug in QNX4 grep?  
No the shell interpreting the $ is not the problem; the $ is in single quotes so the shell does not interpret the $.
It is the same as: grep -c \$  (without quotes).

Your example doesn't work on QNX4 bash or ksh, nor does it work on Linux.

The autoconf people have accepted a workaround to bypass this bug, but the bug still exists. 

What is the procedure for reporting bugs to QNX?
Re: Bug in QNX4 grep?  
On Thu, May 20, 2010 at 05:23:29PM -0400, Mark Hessling wrote:
> No the shell interpreting the $ is not the problem; the $ is in single quotes so the shell does not interpret the $.
> It is the same as: grep -c \$  (without quotes).
> 
> Your example doesn't work on QNX4 bash or ksh, nor does it work on Linux.
> 
> The autoconf people have accepted a workaround to bypass this bug, but the bug still exists. 
> 
> What is the procedure for reporting bugs to QNX?
> 

This works in QNX6 so please make sure the autoconf workaround only
affects QNX4.

Regards,

-seanb
Re: Bug in QNX4 grep?  
> On Thu, May 20, 2010 at 05:23:29PM -0400, Mark Hessling wrote:
> > No the shell interpreting the $ is not the problem; the $ is in single 
> quotes so the shell does not interpret the $.
> > It is the same as: grep -c \$  (without quotes).
> > 
> > Your example doesn't work on QNX4 bash or ksh, nor does it work on Linux.
> > 
> > The autoconf people have accepted a workaround to bypass this bug, but the 
> bug still exists. 
> > 
> > What is the procedure for reporting bugs to QNX?
> > 
> 
> This works in QNX6 so please make sure the autoconf workaround only
> affects QNX4.
> 
> Regards,
> 
> -seanb

The code that causes the problem in autoconf is used to count the number of lines in stdin. At the moment they use:
grep -c '$'
to count the number of "end of lines"
The workaround is to use:
grep -c '^'
to count the number of "start of lines"
which AFAIK will be changed for every platform.

Cheers, Mark

Re: Bug in QNX4 grep?  
Anyway '\$' works on my QNX4 while '$' does not.
Re: Bug in QNX4 grep?  
according ftp://ftp.qnx.com/usr/free/qnx4/gnu/
I would guess that grep on QNX4 is not a port of gnu grep