Subject: bug#7198: ls-misc failure with Oct 10 snapshot

From: Jim Meyering <[email-masked]>
Date: Tue, 12 Oct 2010 19:57:55 +0200

Paul Eggert wrote:
> I got this on RHEL 5 x86-64 compiled with my own GCC 4.5.1.
> Haven't had time to look into it.  Those escape
> sequences are annoying....

Hi Paul,

Thanks for the report.
What version of RHEL 5.N?  I.e., what's "N"?
I couldn't reproduce that on a 5.5 x86-based system using /usr/bin/gcc.
Can you reproduce it with the standard compiler?
What does perl -v print?

> FAIL: misc/ls-misc (exit: 1)
> ============================
>
> ls (GNU coreutils) 8.5.188-9af44
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Richard M. Stallman and David MacKenzie.
> q-...
> q-N...
> q-q...
> q-Q...
> q-lit-q...
> q-qs-lit...
> q-qs-sh...
> q-qs-sh-a...
> q-qs-c...
> q-qs-esc...
> q-qs-c-1...
> emptydir...
> emptydir-x2...
> emptydir-R...
> R-dot...
> slink-dir-F...
> Use of uninitialized value in scalar assignment at ./misc/ls-misc line 36.

Odd that you get those warnings and I don't.
At first I thought I might be able to reproduce the warning
by removing LS_COLORS from my environment, but that didn't work.

Can you see if this gets rid of those warnings?

diff --git a/tests/misc/ls-misc b/tests/misc/ls-misc
index e663a5f..b0c5dce 100755
--- a/tests/misc/ls-misc
+++ b/tests/misc/ls-misc
@@ -27,7 +27,7 @@ my $saved_ls_colors;

 sub push_ls_colors($)
 {
-  $saved_ls_colors = $ENV{LS_COLORS};
+  $saved_ls_colors = $ENV{LS_COLORS} || '';
   $ENV{LS_COLORS} = $_[0];
 }

The failures make it look like ls is being run without the -o option.

If you rerun the test with DEBUG=yes, e.g.,

  make check -C tests TESTS=misc/ls-misc VERBOSE=yes DEBUG=yes

that might give a hint...

...
> ls-misc: test sl-dangle3: stdout mismatch, comparing sl-dangle3.O (actual) and sl-dangle3.1 (expected)
> *** sl-dangle3.O	Tue Oct 12 09:12:22 2010
> --- sl-dangle3.1	Tue Oct 12 09:12:22 2010
> ***************
> *** 1 ****
> ! lrwxrwxrwx 1 eggert 7 Oct 12  2010 l -> nowhere
> --- 1 ----
> ! l -> nowhere
> Use of uninitialized value in scalar assignment at ./misc/ls-misc line 36.
> sl-dangle4...
> ls-misc: test sl-dangle4: stdout mismatch, comparing sl-dangle4.O (actual) and sl-dangle4.1 (expected)
> *** sl-dangle4.O	Tue Oct 12 09:12:22 2010
> --- sl-dangle4.1	Tue Oct 12 09:12:22 2010
> ***************
> *** 1 ****
> ! lrwxrwxrwx 1 eggert 7 Oct 12  2010 l -> nowhere
> --- 1 ----
> ! l -> nowhere
> Use of uninitialized value in scalar assignment at ./misc/ls-misc line 36.
> sl-dangle5...
> ls-misc: test sl-dangle5: stdout mismatch, comparing sl-dangle5.O (actual) and sl-dangle5.1 (expected)
> *** sl-dangle5.O	Tue Oct 12 09:12:22 2010
> --- sl-dangle5.1	Tue Oct 12 09:12:22 2010
> ***************
> *** 1 ****
> ! lrwxrwxrwx 1 eggert 7 Oct 12  2010 l -> nowhere
> --- 1 ----
> ! l -> nowhere
> Use of uninitialized value in scalar assignment at ./misc/ls-misc line 36.
> color-exe1...
> Use of uninitialized value in scalar assignment at ./misc/ls-misc line 36.
> no-a-isdir-b...
> recursive-2...
> setuid-etc...
> file-type...
> version-sort...
> multi-arg-U1...