various changes(colors in ls, ACL/scontext in ls, longoptions for

echo/sleep), see changelog for details
This commit is contained in:
Ondrej Vasik 2008-01-31 15:55:47 +00:00
parent 60a1909547
commit 5d66c4cfdf
5 changed files with 124 additions and 21 deletions

View File

@ -0,0 +1,27 @@
diff -urp coreutils-6.10-orig/src/echo.c coreutils-6.10/src/echo.c
--- coreutils-6.10-orig/src/echo.c 2007-11-25 14:23:31.000000000 +0100
+++ coreutils-6.10/src/echo.c 2008-01-31 14:01:52.000000000 +0100
@@ -163,6 +163,10 @@ main (int argc, char **argv)
{
case 'e': case 'E': case 'n':
break;
+ case '-':
+ /* end of short options(allows to print -n,-e or -E) */
+ argc--;
+ argv++;
default:
goto just_echo;
}
diff -urp coreutils-6.10-orig/lib/long-options.c coreutils-6.10/lib/long-options.c
--- coreutils-6.10-orig/lib/long-options.c 2007-10-17 15:47:26.000000000 +0200
+++ coreutils-6.10/lib/long-options.c 2008-01-31 14:28:01.000000000 +0100
@@ -57,8 +57,7 @@ parse_long_options (int argc,
/* Don't print an error message for unrecognized options. */
opterr = 0;
- if (argc == 2
- && (c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
{
switch (c)
{

View File

@ -1,21 +1,40 @@
#! /bin/csh -f
# color-ls initialization
if ( "$LS_COLORS" != '' ) then
#do not override user specified LS_COLORS and use them
alias ll 'ls -l --color=tty'
alias l. 'ls -d .* --color=tty'
alias ls 'ls --color=tty'
exit
endif
alias ll 'ls -l'
alias l. 'ls -d .*'
set COLORS=/etc/DIR_COLORS
if ($?TERM) then
if ( -e "/etc/DIR_COLORS.$TERM" ) set COLORS="/etc/DIR_COLORS.$TERM"
if ( -e "/etc/DIR_COLORS.$TERM" ) then
set COLORS="/etc/DIR_COLORS.$TERM"
endif
endif
if ( -f ~/.dircolors ) set COLORS=~/.dircolors
if ($?TERM) then
if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM"
if ( -f ~/.dircolors ) then
set COLORS=~/.dircolors
endif
if ( -f ~/.dir_colors ) then
set COLORS=~/.dir_colors
endif
if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors
if ($?TERM) then
if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM"
if ( -f ~/.dircolors."$TERM" ) then
set COLORS=~/.dircolors."$TERM"
endif
if ( -f ~/.dir_colors."$TERM" ) then
set COLORS=~/.dir_colors."$TERM"
endif
endif
if ( ! -e "$COLORS" ) exit
if ( ! -e "$COLORS" ) then
exit
endif
eval `dircolors -c $COLORS`
@ -25,8 +44,8 @@ endif
set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS`
if ( "$color_none" == '' ) then
alias ll 'ls -l --color=tty'
alias l. 'ls -d .* --color=tty'
alias ls 'ls --color=tty'
alias ll 'ls -l --color=tty'
alias l. 'ls -d .* --color=tty'
alias ls 'ls --color=tty'
endif
unset color_none

View File

@ -1,4 +1,10 @@
# color-ls initialization
if [ -n "$LS_COLORS" ]; then
#do not override user LS_COLORS but use them
alias ll='ls -l --color=tty' 2>/dev/null
alias l.='ls -d .* --color=tty' 2>/dev/null
alias ls='ls --color=tty' 2>/dev/null
fi
alias ll='ls -l' 2>/dev/null
alias l.='ls -d .*' 2>/dev/null
@ -6,12 +12,12 @@ alias l.='ls -d .*' 2>/dev/null
COLORS=/etc/DIR_COLORS
[ -e "/etc/DIR_COLORS.$TERM" ] && COLORS="/etc/DIR_COLORS.$TERM"
[ -e "$HOME/.dircolors" ] && COLORS="$HOME/.dircolors"
[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
[ -e "$HOME/.dir_colors" ] && COLORS="$HOME/.dir_colors"
[ -e "$HOME/.dircolors.$TERM" ] && COLORS="$HOME/.dircolors.$TERM"
[ -e "$HOME/.dir_colors.$TERM" ] && COLORS="$HOME/.dir_colors.$TERM"
[ -e "$COLORS" ] || return
eval `dircolors --sh "$COLORS"`
eval `dircolors --sh "$COLORS" 2>/dev/null`
[ -z "$LS_COLORS" ] && return
if ! egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null ; then

View File

@ -243,7 +243,7 @@ diff -urp coreutils-6.10-orig/man/vdir.1 coreutils-6.10/man/vdir.1
diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
--- coreutils-6.10-orig/src/copy.c 2008-01-05 23:59:11.000000000 +0100
+++ coreutils-6.10/src/copy.c 2008-01-25 17:23:17.000000000 +0100
@@ -370,9 +367,10 @@ copy_reg (char const *src_name, char con
@@ -371,9 +371,10 @@ copy_reg (char const *src_name, char con
security_context_t con = NULL;
if (getfscreatecon (&con) < 0)
{
@ -255,7 +255,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
return_val = false;
goto close_src_and_dst_desc;
}
@@ -383,11 +387,12 @@ copy_reg (char const *src_name, char con
@@ -383,11 +384,12 @@ copy_reg (char const *src_name, char con
{
if (fsetfilecon (dest_desc, con) < 0)
{
@ -271,7 +271,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
return_val = false;
freecon (con);
goto close_src_and_dst_desc;
@@ -1630,11 +1635,12 @@ copy_internal (char const *src_name, cha
@@ -1630,11 +1632,12 @@ copy_internal (char const *src_name, cha
{
if (setfscreatecon (con) < 0)
{
@ -287,7 +287,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
freecon (con);
return false;
}
@@ -1644,12 +1650,14 @@ copy_internal (char const *src_name, cha
@@ -1644,12 +1647,14 @@ copy_internal (char const *src_name, cha
else
{
if (errno != ENOTSUP && errno != ENODATA)
@ -308,7 +308,7 @@ diff -urp coreutils-6.10-orig/src/copy.c coreutils-6.10/src/copy.c
}
}
}
@@ -1735,6 +1743,8 @@ copy_internal (char const *src_name, cha
@@ -1735,6 +1740,8 @@ copy_internal (char const *src_name, cha
{
/* Here, we are crossing a file system boundary and cp's -x option
is in effect: so don't copy the contents of this directory. */
@ -532,6 +532,18 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
};
/* Display letters and indicators for each filetype.
@@ -177,8 +178,9 @@ struct fileinfo
exists, otherwise false. */
bool linkok;
- /* For long listings, true if the file has an access control list,
- or an SELinux security context. */
+ /* For long listings, true if the file has an access control list.
+ Unlike with upstream not true for SELinux scontext(#430779) as
+ this removes possibility to detect ACL via ls */
bool have_acl;
};
@@ -241,6 +242,7 @@ static void queue_directory (char const
static void sort_files (void);
static void parse_ls_color (void);
@ -709,6 +721,26 @@ diff -urp coreutils-6.10-orig/src/ls.c coreutils-6.10/src/ls.c
{
bool have_acl = false;
int attr_len = (do_deref
@@ -2667,9 +2694,7 @@ gobble_file (char const *name, enum file
: lgetfilecon (absolute_name, &f->scontext));
err = (attr_len < 0);
- if (err == 0)
- have_acl = ! STREQ ("unlabeled", f->scontext);
- else
+ if (err != 0)
{
f->scontext = UNKNOWN_SECURITY_CONTEXT;
@@ -2681,7 +2706,7 @@ gobble_file (char const *name, enum file
err = 0;
}
- if (err == 0 && ! have_acl && format == long_format)
+ if (err == 0 && format == long_format)
{
int n = file_has_acl (absolute_name, &f->stat);
err = (n < 0);
@@ -3255,6 +3281,13 @@ print_current_files (void)
print_long_format (sorted_file[i]);
DIRED_PUTCHAR ('\n');
@ -1124,12 +1156,17 @@ diff -urp coreutils-6.10-orig/src/stat.c coreutils-6.10/src/stat.c
diff -urp coreutils-6.10-orig/tests/misc/selinux coreutils-6.10/tests/misc/selinux
--- coreutils-6.10-orig/tests/misc/selinux 2008-01-11 11:34:22.000000000 +0100
+++ coreutils-6.10/tests/misc/selinux 2008-01-25 18:17:59.000000000 +0100
@@ -32,7 +32,7 @@ chcon $ctx f d p 2>/dev/null || {
@@ -32,12 +32,10 @@ chcon $ctx f d p 2>/dev/null || {
# inspect that context with both ls -Z and stat.
for i in d f p; do
- c=`ls -dogZ $i|cut -d' ' -f3`; test x$c = x$ctx || fail=1
+ c=`ls -dogZ $i|cut -d' ' -f4`; test x$c = x$ctx || fail=1
+ c=`ls -dogZ $i|cut -d' ' -f5`; test x$c = x$ctx || fail=1
c=`stat --printf %C $i`; test x$c = x$ctx || fail=1
done
-# ensure that ls -l output includes the "+".
-c=`ls -l f|cut -c11`; test "$c" = + || fail=1
# Copy each to a new directory and ensure that context is preserved.
cp -r --preserve=all d f p s1 || fail=1

View File

@ -1,7 +1,7 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.10
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -23,6 +23,7 @@ Source203: coreutils-runuser-l.pamd
Patch100: coreutils-chgrp.patch
Patch101: coreutils-6.10-configuration.patch
Patch102: coreutils-6.10-manpages.patch
Patch103: coreutils-6.10-longoptions.patch
# sh-utils
Patch703: sh-utils-2.0.11-dateman.patch
@ -99,6 +100,7 @@ cd %name-%version
%patch100 -p1 -b .chgrp
%patch101 -p1 -b .configure
%patch102 -p1 -b .manpages
%patch103 -p1 -b .longopt
# sh-utils
%patch703 -p1 -b .dateman
@ -289,6 +291,18 @@ fi
/sbin/runuser
%changelog
* Thu Jan 31 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-3
- fix unability of echo to display certain strings(added --
separator, #431005)
- do not require only one long_opt for certain commands
e.g. sleep, yes - but use first usable (#431005)
- do not override userspecified LS_COLORS variable, but
use it for colored ls(#430827)
- discard errors from dircolors to /dev/null + some tuning
of lscolor sh/csh scripts(#430823)
- do not consider files with SELinux security context as
files having ACL in ls long format(#430779)
* Mon Jan 28 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-2
- some manpages improvements(#406981,#284881)
- fix non-versioned obsoletes of mktemp(#430407)