Subject: bug#8728: test 'stat-free-color' failed (latest git version v8.12-42-g7d44751)

From: Stefano Lattarini <[email-masked]>
Date: Tue, 24 May 2011 23:21:49 +0200

On Tuesday 24 May 2011, Jim Meyering wrote:
> Stefano Lattarini wrote:
> > The log of the failed test is attached.  I've not looked into it in any way.
> > Let me know if you need more information.
> >
> > Regards,
> >   Stefano
> >
> > FAIL: ls/stat-free-color (exit: 1)
> > ==================================
> ...
> > + strace -o log -e stat,lstat ls --color=always .
> > color-without-stat
> ...
> > ++ wc -l
> > + n_lines=0
> > + test 0 = 1
> > + fail=1
> 
> Hi Stefano,
> Thanks for the report.
> It would help to know why strace reported no matches.
> Maybe it's due to alternate names like stat64?
>
> If you apply the following patch and rerun that test,
> it should provide that information:
> 
>     make check -C tests TESTS=ls/stat-free-color VERBOSE=yes
>
The patch does not help to get more information IMHO, because the failure
is caused precisely by the fact that `log' is empty (as can be inferred by
the fact that n_lines=`wc -l <log` resulted in $n_lines being 0).

> If my guess is correct, then adding ",stat64,lstat64"
> to the strace command may be the solution:
> 
>    strace -o log -e stat,lstat,stat64,lstat64 ls --color=always . || fail=1
>
Yes, this does indeed fix the failure.

> From 06a94be331d7e31048f2bb4e659130159cd454f0 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email-masked]>
> Date: Tue, 24 May 2011 23:06:31 +0200
> Subject: [PATCH] tests: stat-free-color: write more into the log upon failure
> 
> * tests/ls/stat-free-color: Print syscall log upon error,
> to aid diagnosis.
> ---
>  tests/ls/stat-free-color |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/ls/stat-free-color b/tests/ls/stat-free-color
> index d11c6f4..f14beb9 100755
> --- a/tests/ls/stat-free-color
> +++ b/tests/ls/stat-free-color
> @@ -49,6 +49,6 @@ eval $(dircolors -b color-without-stat)
> 
>  strace -o log -e stat,lstat ls --color=always . || fail=1
>  n_lines=$(wc -l < log)
> -test $n_lines = 1 || fail=1
> +test $n_lines = 1 || { fail=1; cat log; }
> 
>  Exit $fail
> --
> 1.7.5.2.585.gfbd48
> 

Thanks,
  Stefano