]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls -v: exercise the bug fixed by gnulib's new filevercmp
authorJim Meyering <meyering@redhat.com>
Sat, 7 Mar 2009 19:41:00 +0000 (20:41 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 8 Mar 2009 20:18:47 +0000 (21:18 +0100)
* tests/misc/ls-misc (version-sort): New test.
(mk_file): New function.
Reported by Josh Triplett in <http://bugs.debian.org/517558>.
Details in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/16902
* NEWS (Bug fixes): Mention it.

NEWS
THANKS
tests/misc/ls-misc

diff --git a/NEWS b/NEWS
index 0f6e8533af6895d07cf8dec04ae722171ca9c235..63c7e19dd73791324945c11ac8a3ee200e05ca5a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ GNU coreutils NEWS                                    -*- outline -*-
   The bug strikes only with both --recursive (-r, -R) and --link (-l).
   [bug introduced in coreutils-7.1]
 
+  ls --sort=version (-v) sorted names beginning with "." inconsistently.
+  Now, names that start with "." are always listed before those that don't.
+
   pr: fix the bug whereby --indent=N (-o) did not indent header lines
   [bug introduced in coreutils-6.9.90]
 
diff --git a/THANKS b/THANKS
index e40d2b08836ed83e30c87ca9b075ec9beafdea60..46d077b1d82c71d09343facf183c3c967455db37 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -290,6 +290,7 @@ Jon Peatfield                       J.S.Peatfield@damtp.cam.ac.uk
 Joost van Baal                      joostvb@xs4all.nl
 Jorge Stolfi                        stolfi@ic.unicamp.br
 Joseph S. Myers                     jsm28@cam.ac.uk
+Josh Triplett                       josh@freedesktop.org
 Joshua Hudson                       joshudson@gmail.com
 Josselin Mouette                    joss@debian.org
 Juan F. Codagnone                   juam@arnet.com.ar
index 5a93b510c3481af9fd2ac7a13c7b6aea60a35cd7..b58949e34b21e026bc8c20ba1479e6bbaa5c0ed3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# Copyright (C) 1998, 2000-2008 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2000-2009 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -64,12 +64,20 @@ sub setuid_setup()
                 . "so can't run this test\n"), exit 77;
 }
 
+sub mk_file(@)
+{
+  foreach my $f (@_)
+    {
+      open (F, '>', $f) && close F
+       or die "creating $f: $!\n";
+    }
+}
+
 sub mkdir_d {mkdir 'd',0755 or die "d: $!\n"}
 sub rmdir_d {rmdir 'd'      or die "d: $!\n"}
 my $mkdir = {PRE => sub {mkdir_d}};
 my $rmdir = {POST => sub {rmdir_d}};
-my $mkdir_reg = {PRE => sub {mkdir_d; open (FH, '>d/f') && close FH
-                              or die "d/f: $!\n" }};
+my $mkdir_reg = {PRE => sub {mkdir_d; mk_file 'd/f' }};
 my $rmdir_reg = {POST => sub {unlink 'd/f' or die "d/f: $!\n";
                              rmdir 'd' or die "d: $!\n"}};
 
@@ -100,10 +108,12 @@ my $rmdir_d_slink = {POST => sub {unlink 'd/s' or die "d/s: $!\n";
 sub make_j_d ()
 {
   mkdir 'j', 0700 or die "creating j: $!\n";
-  (open F, '>j/d') && close F or die "creating j/d: $!\n";
+  mk_file 'j/d';
   chmod 0555, 'j/d' or die "making j/d executable: $!\n";
 }
 
+my @v1 = qw(0 9 A Z a z);
+my @v_files = ((map { ".$_" } @v1), @v1);
 my $exe_in_subdir = {PRE => sub { make_j_d (); push_ls_colors('ex=01;32') }};
 my $remove_j = {POST => sub {unlink 'j/d' or die "j/d: $!\n";
                              rmdir 'j' or die "j: $!\n";
@@ -207,6 +217,13 @@ my @Tests =
      # For 5.97 and earlier, --file-type acted like --indicator-style=slash.
      ['file-type', '--file-type d', {OUT => "s@\n"},
       $mkdir_d_slink, $rmdir_d_slink],
+
+     # 7.1 had a regression in how -v -a ordered some files
+     ['version-sort', '-v -A ' . join (' ', @v_files),
+      {OUT => join ("\n", @v_files) . "\n"},
+      {PRE => sub { mk_file @v_files }},
+      {POST => sub { unlink @v_files }},
+      ],
     );
 
 # Start with an unset LS_COLORS environment variable.