- ls -1U with two or more arguments (or with -R or -s) works properly again

- install runs faster again with SELinux enabled (#479502)
This commit is contained in:
Kamil Dudka 2009-08-05 08:56:45 +00:00
parent 4f510d965d
commit 03331ced26
3 changed files with 127 additions and 1 deletions

View File

@ -0,0 +1,26 @@
diff -ruNp coreutils-7.2.orig/m4/jm-macros.m4 coreutils-7.2/m4/jm-macros.m4
--- coreutils-7.2.orig/m4/jm-macros.m4 2009-08-05 10:50:48.389482889 +0200
+++ coreutils-7.2/m4/jm-macros.m4 2009-08-05 10:53:37.894733210 +0200
@@ -47,7 +47,21 @@ AC_DEFUN([coreutils_MACROS],
AC_CHECK_FUNCS_ONCE([directio])
# Used by install.c.
- AC_CHECK_FUNCS_ONCE([matchpathcon_init_prefix])
+ coreutils_saved_libs=$LIBS
+ LIBS="$LIBS $LIB_SELINUX"
+ AC_CHECK_FUNCS([matchpathcon_init_prefix], [],
+ [
+ case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
+ no:*) # SELinux disabled
+ ;;
+ *:no) # SELinux disabled
+ ;;
+ *)
+ AC_MSG_WARN([SELinux enabled, but matchpathcon_init_prefix not found])
+ AC_MSG_WARN([The install utility may run slowly])
+ esac
+ ])
+ LIBS=$coreutils_saved_libs
# Used by sort.c.
AC_CHECK_FUNCS_ONCE([nl_langinfo])

92
coreutils-7.4-ls-1U.patch Normal file
View File

@ -0,0 +1,92 @@
diff -ruNp coreutils-7.2.orig/src/ls.c coreutils-7.2/src/ls.c
--- coreutils-7.2.orig/src/ls.c 2009-08-05 10:50:48.432858145 +0200
+++ coreutils-7.2/src/ls.c 2009-08-05 10:52:21.066692900 +0200
@@ -2411,6 +2411,19 @@ print_dir (char const *name, char const
DEV_INO_PUSH (dir_stat.st_dev, dir_stat.st_ino);
}
+ if (recursive | print_dir_name)
+ {
+ if (!first)
+ DIRED_PUTCHAR ('\n');
+ first = false;
+ DIRED_INDENT ();
+ PUSH_CURRENT_DIRED_POS (&subdired_obstack);
+ dired_pos += quote_name (stdout, realname ? realname : name,
+ dirname_quoting_options, NULL);
+ PUSH_CURRENT_DIRED_POS (&subdired_obstack);
+ DIRED_FPUTS_LITERAL (":\n", stdout);
+ }
+
/* Read the directory entries, and insert the subfiles into the `cwd_file'
table. */
@@ -2450,7 +2463,8 @@ print_dir (char const *name, char const
ls uses constant memory while processing the entries of
this directory. Useful when there are many (millions)
of entries in a directory. */
- if (format == one_per_line && sort_type == sort_none)
+ if (format == one_per_line && sort_type == sort_none
+ && !print_block_size && !recursive)
{
/* We must call sort_files in spite of
"sort_type == sort_none" for its initialization
@@ -2486,19 +2500,6 @@ print_dir (char const *name, char const
if (recursive)
extract_dirs_from_files (name, command_line_arg);
- if (recursive | print_dir_name)
- {
- if (!first)
- DIRED_PUTCHAR ('\n');
- first = false;
- DIRED_INDENT ();
- PUSH_CURRENT_DIRED_POS (&subdired_obstack);
- dired_pos += quote_name (stdout, realname ? realname : name,
- dirname_quoting_options, NULL);
- PUSH_CURRENT_DIRED_POS (&subdired_obstack);
- DIRED_FPUTS_LITERAL (":\n", stdout);
- }
-
if (format == long_format || print_block_size)
{
const char *p;
diff -ruNp coreutils-7.2.orig/tests/misc/ls-misc coreutils-7.2/tests/misc/ls-misc
--- coreutils-7.2.orig/tests/misc/ls-misc 2009-03-29 19:44:10.000000000 +0200
+++ coreutils-7.2/tests/misc/ls-misc 2009-08-05 10:52:21.067920550 +0200
@@ -18,6 +18,7 @@
use strict;
(my $program_name = $0) =~ s|.*/||;
+my $prog = 'ls';
# Turn off localization of executable's output.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -224,6 +225,18 @@ my @Tests =
{PRE => sub { mk_file @v_files }},
{POST => sub { unlink @v_files }},
],
+
+ # Test for the ls -1U bug fixed in coreutils-7.5.
+ # It is triggered only with -1U and with two or more arguments,
+ # at least one of which is a nonempty directory.
+ ['multi-arg-U1', '-U1 d no-such',
+ {OUT => "d:\nf\n"},
+ {ERR_SUBST=>'s/ch:.*/ch:/'},
+ {ERR => "$prog: cannot access no-such:\n"},
+ $mkdir_reg,
+ $rmdir_reg,
+ {EXIT => 2},
+ ],
);
# Start with an unset LS_COLORS environment variable.
@@ -232,8 +245,6 @@ delete $ENV{LS_COLORS};
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
-my $prog = 'ls';
-
setuid_setup;
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
$fail

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 7.2
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -19,6 +19,8 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
Patch1: coreutils-7.4-ls-1U.patch
Patch2: coreutils-7.4-install-SELinux.patch
# Our patches
Patch100: coreutils-6.10-configuration.patch
@ -99,6 +101,8 @@ the old GNU fileutils, sh-utils, and textutils packages.
%setup -q
# From upstream
%patch1 -p1 -b .ls-1U
%patch2 -p1 -b .install-SELinux
# Our patches
%patch100 -p1 -b .configure
@ -311,6 +315,10 @@ fi
/sbin/runuser
%changelog
* Wed Aug 05 2009 Kamil Dudka <kdudka@redhat.com> - 7.2-3
- ls -1U with two or more arguments (or with -R or -s) works properly again
- install runs faster again with SELinux enabled (#479502)
* Wed Jul 09 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-2
- do not ignore sort's version sort for multibyte locales
(#509688)