On Monday 10 November 2008 22:05, Matthias Kilian wrote:
> On Mon, Nov 10, 2008 at 08:03:50PM +0000, Eric Kow wrote:
> > > Mon Nov 10 02:36:03 CET 2008  Thorkil Naur <[EMAIL PROTECTED]>
> > >   * Work around grep -Fw platform differences in haskell_policy.sh
> > 
> > Applied, thanks!  We've discovered in a previous patch that we should
> > use fgrep in place of grep -F
> 
> I think this is a different issue. fgrep(1) isn't POSIX, but it
> works on some older OSs (was it solaris?) with an old grep(1) not
> supporting -F. The -w flag to grep(1) isn't POSIX either, but
> according to Thorkil it behaves *differently* on different platforms.
> 
> @Thorkil: could you send me some examples of grep -Fw differences?

Sure. Here are some examples from the machine named tn9. This is a SuSE Linux, 
the one that runs the darcs buildbot slave that failed:

> [EMAIL PROTECTED]:~/tn/test/grep> cat t5.hs
> dP
> d
> [EMAIL PROTECTED]:~/tn/test/grep> grep -Fw d t5.hs
> dP
> d
> [EMAIL PROTECTED]:~/tn/test/grep> cat t6.hs
> dP
> e
> [EMAIL PROTECTED]:~/tn/test/grep> grep -Fw d t6.hs
> [EMAIL PROTECTED]:~/tn/test/grep> diff t5.hs t6.hs
> 2c2
> < d
> ---
> > e
> [EMAIL PROTECTED]:~/tn/test/grep> grep --version
> grep (GNU grep) 2.5.1

In this case, the grep for t5.hs finds too much. This is similar to the 
behaviour we have seen for the buildbot slave that fails.

The t6.hs is interesting, because it actually works (not matching the first 
line) when the match in the second line is removed. All in all, this looks 
like a grep error.

Another variation that I have tried is adding lines between the first and 
second lines of t5.hs. It turns out that the incorrect match of the first 
line disappears somewhere between adding 1000 and 10000 rather short lines. 
Some buffer size dependency seems indicated.

Running the same examples on tn10 (which is a PPC Mac OS X 10.4):

> Thorkil-Naurs-Computer:~/tn/test/grep thorkilnaur$ cat t5.hs
> dP
> d
> Thorkil-Naurs-Computer:~/tn/test/grep thorkilnaur$ grep -Fw d t5.hs
> Thorkil-Naurs-Computer:~/tn/test/grep thorkilnaur$ cat t6.hs
> dP
> e
> Thorkil-Naurs-Computer:~/tn/test/grep thorkilnaur$ grep -Fw d t6.hs
> Thorkil-Naurs-Computer:~/tn/test/grep thorkilnaur$ grep --version
> grep (GNU grep) 2.5.1

This is also incorrect, but in a different way: Now the second line of t5.hs 
fails to match.

Finally, on tn20 (PPC Mac OS X 10.5):

> thorkil-naurs-mac-mini:~/tn/test/grep thorkilnaur$ cat t5.hs
> dP
> d
> thorkil-naurs-mac-mini:~/tn/test/grep thorkilnaur$ grep -Fw d t5.hs
> d
> thorkil-naurs-mac-mini:~/tn/test/grep thorkilnaur$ cat t6.hs
> dP
> e
> thorkil-naurs-mac-mini:~/tn/test/grep thorkilnaur$ grep -Fw d t6.hs
> thorkil-naurs-mac-mini:~/tn/test/grep thorkilnaur$ grep --version
> grep (GNU grep) 2.5.1

This is the behaviour, I would have expected.

I tried to download the source for both grep-2.5.1 and the latest one I was 
able to find which was grep-2.5.3. One remark I found in the change log for 
grep-2.5.3 was:

> 2005-04-27  Julian Foad  <[EMAIL PROTECTED]>
>
>       Fix a bug reported by Elliott Hughes in patch #1834 whereby "grep -Fw"
>       would miss matches after a non-word occurrence of the pattern.  Fix by
>       Gordon Lack; tests based on reproduction recipes by Gordon Lack.
>
>       * src/search.c (Fexecute): Fix the "match_words" case.
>       * tests/foad1.sh: Modify the test framework so that the "PATTERN"
>         argument is optional.  Add a regression test and a test for
>         a similar case that other proposed patches have got wrong.
>

This certainly seems to address the -Fw problem. In addition, I was able to 
build a grep-2.5.1 that behaved like tn10 (failing to match second line of 
t5.hs) and a grep-2.5.3 that behaved correctly. I have not tried to look 
further, e.g. for a grep that behaves like tn9 (incorrectly matching the 
first line of t5.hs).

I hope that these are the sort of things you are looking for. Otherwise, I'll 
be happy to provide additional material.

> ...

Best regards
Thorkil
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to