Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Inappropriate [legacy version] |
| 2 | |
| 3 | This patch was imported from the Fedora Core 8 coreutils-6.9-9 package. |
| 4 | |
| 5 | The package is stated as being Licensed as GPLv2+. |
| 6 | |
| 7 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
| 8 | |
| 9 | --- coreutils-6.9/src/ls.c.ls-x 2007-06-13 14:27:36.000000000 +0100 |
| 10 | +++ coreutils-6.9/src/ls.c 2007-06-13 14:28:42.000000000 +0100 |
| 11 | @@ -4151,16 +4151,16 @@ |
| 12 | size_t pos = 0; |
| 13 | size_t cols = calculate_columns (false); |
| 14 | struct column_info const *line_fmt = &column_info[cols - 1]; |
| 15 | - size_t name_length = length_of_file_name_and_frills (cwd_file); |
| 16 | + struct fileinfo const *f = sorted_file[0]; |
| 17 | + size_t name_length = length_of_file_name_and_frills (f); |
| 18 | size_t max_name_length = line_fmt->col_arr[0]; |
| 19 | |
| 20 | /* Print first entry. */ |
| 21 | - print_file_name_and_frills (cwd_file); |
| 22 | + print_file_name_and_frills (f); |
| 23 | |
| 24 | /* Now the rest. */ |
| 25 | for (filesno = 1; filesno < cwd_n_used; ++filesno) |
| 26 | { |
| 27 | - struct fileinfo const *f; |
| 28 | size_t col = filesno % cols; |
| 29 | |
| 30 | if (col == 0) |
| 31 | --- coreutils-6.9/tests/ls/Makefile.am.ls-x 2007-03-18 21:36:43.000000000 +0000 |
| 32 | +++ coreutils-6.9/tests/ls/Makefile.am 2007-06-13 14:28:42.000000000 +0100 |
| 33 | @@ -24,7 +24,7 @@ |
| 34 | stat-dtype \ |
| 35 | inode dangle file-type recursive dired infloop \ |
| 36 | rt-1 time-1 symlink-slash follow-slink no-arg m-option \ |
| 37 | - stat-vs-dirent |
| 38 | + stat-vs-dirent x-option |
| 39 | |
| 40 | EXTRA_DIST = $(TESTS) |
| 41 | TESTS_ENVIRONMENT = \ |
| 42 | --- /dev/null 2007-06-13 08:43:51.993263382 +0100 |
| 43 | +++ coreutils-6.9/tests/ls/x-option 2007-06-13 14:28:42.000000000 +0100 |
| 44 | @@ -0,0 +1,59 @@ |
| 45 | +#!/bin/sh |
| 46 | +# Exercise the -x option. |
| 47 | + |
| 48 | +# Copyright (C) 2007 Free Software Foundation, Inc. |
| 49 | + |
| 50 | +# This program is free software; you can redistribute it and/or modify |
| 51 | +# it under the terms of the GNU General Public License as published by |
| 52 | +# the Free Software Foundation; either version 2 of the License, or |
| 53 | +# (at your option) any later version. |
| 54 | + |
| 55 | +# This program is distributed in the hope that it will be useful, |
| 56 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 57 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 58 | +# GNU General Public License for more details. |
| 59 | + |
| 60 | +# You should have received a copy of the GNU General Public License |
| 61 | +# along with this program; if not, write to the Free Software |
| 62 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 63 | +# 02110-1301, USA. |
| 64 | + |
| 65 | +if test "$VERBOSE" = yes; then |
| 66 | + set -x |
| 67 | + ls --version |
| 68 | +fi |
| 69 | + |
| 70 | +. $srcdir/../envvar-check |
| 71 | +. $srcdir/../lang-default |
| 72 | + |
| 73 | +pwd=`pwd` |
| 74 | +t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ |
| 75 | +trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0 |
| 76 | +trap '(exit $?); exit $?' 1 2 13 15 |
| 77 | + |
| 78 | +framework_failure=0 |
| 79 | +mkdir -p $tmp || framework_failure=1 |
| 80 | +cd $tmp || framework_failure=1 |
| 81 | +mkdir subdir || framework_failure=1 |
| 82 | +touch subdir/b || framework_failure=1 |
| 83 | +touch subdir/a || framework_failure=1 |
| 84 | + |
| 85 | +if test $framework_failure = 1; then |
| 86 | + echo "$0: failure in testing framework" 1>&2 |
| 87 | + (exit 1); exit 1 |
| 88 | +fi |
| 89 | + |
| 90 | +fail=0 |
| 91 | + |
| 92 | +# Coreutils 6.8 and 6.9 would output this in the wrong order. |
| 93 | +ls -x subdir > out || fail=1 |
| 94 | +ls -rx subdir >> out || fail=1 |
| 95 | +cat <<\EOF > exp || fail=1 |
| 96 | +a b |
| 97 | +b a |
| 98 | +EOF |
| 99 | + |
| 100 | +cmp out exp || fail=1 |
| 101 | +test $fail = 1 && diff out exp 2> /dev/null |
| 102 | + |
| 103 | +(exit $fail); exit $fail |
| 104 | --- coreutils-6.9/NEWS.ls-x 2007-03-22 21:19:45.000000000 +0000 |
| 105 | +++ coreutils-6.9/NEWS 2007-06-13 14:28:42.000000000 +0100 |
| 106 | @@ -13,6 +13,11 @@ |
| 107 | Using pr -m -s (i.e. merging files, with TAB as the output separator) |
| 108 | no longer inserts extraneous spaces between output columns. |
| 109 | |
| 110 | +** Bug fixes |
| 111 | + |
| 112 | + ls -x DIR would sometimes output the wrong string in place of the |
| 113 | + first entry. [introduced in coreutils-6.8] |
| 114 | + |
| 115 | |
| 116 | * Noteworthy changes in release 6.8 (2007-02-24) [not-unstable] |
| 117 | |