[mdlug] grep bug?

Raymond McLaughlin driveray at ameritech.net
Wed Apr 16 18:51:47 EDT 2008


On OpenSuSE 10.3 no such problem:

  pts/1 $ true && ( echo hello | grep --color=always -e ^ | hexdump -C\
  | head -1; echo hello | grep -i --color=always -e ^ | hexdump -C |\
  head\ -1; )
  00000000  68 65 6c 6c 6f 0a                                 |hello.|
  00000000  68 65 6c 6c 6f 0a                                 |hello.|

  pts/1 $ grep -V |head -1
  GNU grep 2.5.2

Since I'm one minor rev ahead of you that might have been a bug fix. Are
you as up to date as you can be? Alternatively it could be a compiler
flag isse, rather thatn a bug in the code itself.

Either way, this kind of thing concerns me. You(or at least I) would
think that these core utilities would be better tested before being
shipped in a "production" distro. Notice the following anomalous
behavior of tail (tail (GNU coreutils) 6.9) on OpenSuSE 10.3:

  pts/1 $ echo "It was the best of times..." | tail -c10;echo
   times...
  pts/1 $ echo "It was the best of times..." | tail -c 10
  tail: cannot open `10' for reading: No such file or directory
  pts/1 $

I would expect (wrongly?) either syntax to work. Indeed it does so with
the head command:

  pts/1 $ echo "It was the best of times..." | head -c10;echo
  It was the
  pts/1 $ echo "It was the best of times..." | head -c 10;echo
  It was the
  pts/1 $

I have also confirmed this behavior on SuSE 10.2 ((GNU coreutils 6.4)

Looks like a set of scripts need to be written to test all the possible
combinations of switches for the core utilities. Hmmm. No small project...

Raymond McLaughlin




More information about the mdlug mailing list