Subject: bug#18892: few test failure with 'grep-2.20.72-d512'

From: Assaf Gordon <[email-masked]>
Date: Sat, 01 Nov 2014 21:26:45 -0400

Hello,

On 11/01/2014 07:06 PM, Jim Meyering wrote:
>> On NetBSD 6.1.4, these fail:
>>    XFAIL: equiv-classes
>>    FAIL: symlink
>>    FAIL: word-multibyte
>
<...>

> However, I'll need more information to understand the "symlink" failure.
> Normally the log file contains verbose output information (resulting
> from init.sh's "set -x"), but on your NetBSD system, it appears not to
> have been enabled, perhaps because that system's /bin/sh is
> inadequate.  Can you rerun the tests using bash as your shell?  That
> may be enough to evoke the log information that will highlight which
> part(s) of the "symlink" test actually fail.

It turned out not to be directly a shell issue (I tried with forcing shell to bash), but a BSD make vs GNU make.
using "gmake" did use the correct shell, and produced a detailed log, which is attached.

If I understand correctly, the failure is triggered in line 177 in the attached log.
running "grep -r '^'" was supposed to return zero, but it returns 2.

I disabled the removal of the temporary directory, and so was able to reproduce manually:
====
$ uname -a
NetBSD  6.1.4 NetBSD 6.1.4 (GENERIC) amd64

$ pwd
/tmp/grep-2.20.72-d512/tests/gt-symlink.1F01
$ ls -lR
total 20
drwxr-xr-x  2 miles  wheel  512 Nov  2 00:55 dir
-rw-r--r--  1 miles  wheel   30 Nov  2 00:55 exp
-rw-r--r--  1 miles  wheel   30 Nov  2 00:55 grepout
-rw-r--r--  1 miles  wheel   30 Nov  2 00:55 out
-rw-r--r--  1 miles  wheel   30 Nov  2 00:55 out-t

./dir:
total 8
-rw-r--r--  1 miles  wheel  2 Nov  2 00:55 a
-rw-r--r--  1 miles  wheel  2 Nov  2 00:55 b
lrwxr-xr-x  1 miles  wheel  1 Nov  2 00:55 c -> a
lrwxr-xr-x  1 miles  wheel  1 Nov  2 00:55 d -> .
lrwxr-xr-x  1 miles  wheel  8 Nov  2 00:55 e -> dangling

$ cd dir
$ pwd
/tmp/grep-2.20.72-d512/tests/gt-symlink.1F01/dir

$ ../../../src/grep -r '^' ; echo $?
a:a
b:b
../../../src/grep: c: Inappropriate file type or format
../../../src/grep: d: Inappropriate file type or format
../../../src/grep: e: Inappropriate file type or format
2
====

For comparison,
On Linux (Ubuntu 14.04.1 amd64), the exit code is zero, somehow c,d,e are ignored:

===
$ uname -a
Linux XXXX 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 GNU/Linux
$ pwd
/tmp/grep/grep-2.20.72-d512/tests/gt-symlink.3Zym
$ ls -lR
.:
total 20
drwxrwxr-x 2 gordon gordon 4096 Nov  1 21:18 dir
-rw-rw-r-- 1 gordon gordon   30 Nov  1 21:18 exp
-rw-rw-r-- 1 gordon gordon   30 Nov  1 21:18 grepout
-rw-rw-r-- 1 gordon gordon   30 Nov  1 21:18 out
-rw-rw-r-- 1 gordon gordon   30 Nov  1 21:18 out-t

./dir:
total 8
-rw-rw-r-- 1 gordon gordon 2 Nov  1 21:18 a
-rw-rw-r-- 1 gordon gordon 2 Nov  1 21:18 b
lrwxrwxrwx 1 gordon gordon 1 Nov  1 21:18 c -> a
lrwxrwxrwx 1 gordon gordon 1 Nov  1 21:18 d -> .
lrwxrwxrwx 1 gordon gordon 8 Nov  1 21:18 e -> dangling

$ cd dir
$ pwd
/tmp/grep/grep-2.20.72-d512/tests/gt-symlink.3Zym/dir

$ ../../../src/grep -r '^' ; echo $?
b:b
a:a
0
===

  - Assaf