diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index ea2be8b..fd58391 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -1,7 +1,8 @@ # color-ls initialization -if ( $?LS_COLORS ) then - if ( "$LS_COLORS" != "" ) then - #do not override user specified LS_COLORS and use them +if ( $?USER_LS_COLORS ) then + if ( "$USER_LS_COLORS" != "" ) then + #when USER_LS_COLORS defined do not override user + #specified LS_COLORS and use them goto finish endif endif diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index ed8a365..2f58eef 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -1,7 +1,7 @@ # color-ls initialization -#do not override user LS_COLORS, but use them. -if [ -z "$LS_COLORS" ]; then +#when USER_LS_COLORS defined do not override user LS_COLORS, but use them. +if [ -z "$USER_LS_COLORS" ]; then alias ll='ls -l' 2>/dev/null alias l.='ls -d .*' 2>/dev/null @@ -26,7 +26,7 @@ if [ -z "$LS_COLORS" ]; then # Existence of $COLORS already checked above. [ -n "$COLORS" ] || return - eval `dircolors --sh "$COLORS" 2>/dev/null` + eval "`dircolors --sh "$COLORS" 2>/dev/null`" [ -z "$LS_COLORS" ] && return egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return fi diff --git a/coreutils-dddoubleclose.patch b/coreutils-dddoubleclose.patch new file mode 100644 index 0000000..3e37027 --- /dev/null +++ b/coreutils-dddoubleclose.patch @@ -0,0 +1,45 @@ +diff -urNp coreutils-6.9-orig/src/dd.c coreutils-6.9/src/dd.c +--- coreutils-6.9-orig/src/dd.c ++++ coreutils-6.9/src/dd.c +@@ -391,6 +391,25 @@ static char const ebcdic_to_ascii[] = + '\070', '\071', '\372', '\373', '\374', '\375', '\376', '\377' + }; + ++/* True if we need to close the standard output *stream*. */ ++static bool close_stdout_required = true; ++ ++/* The only reason to close the standard output *stream* is if ++ parse_long_options fails (as it does for --help or --version). ++ In any other case, dd uses only the STDOUT_FILENO file descriptor, ++ and the "cleanup" function calls "close (STDOUT_FILENO)". ++ Closing the file descriptor and then letting the usual atexit-run ++ close_stdout function call "fclose (stdout)" would result in a ++ harmless failure of the close syscall (with errno EBADF). ++ This function serves solely to avoid the unnecessary close_stdout ++ call, once parse_long_options has succeeded. */ ++static void ++maybe_close_stdout (void) ++{ ++ if (close_stdout_required) ++ close_stdout (); ++} ++ + void + usage (int status) + { +@@ -1639,12 +1658,14 @@ main (int argc, char **argv) + textdomain (PACKAGE); + + /* Arrange to close stdout if parse_long_options exits. */ +- atexit (close_stdout); ++ atexit (maybe_close_stdout); + + page_size = getpagesize (); + + parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION, + usage, AUTHORS, (char const *) NULL); ++ close_stdout_required = false; ++ + if (getopt_long (argc, argv, "", NULL, NULL) != -1) + usage (EXIT_FAILURE); + diff --git a/coreutils.spec b/coreutils.spec index f176ab6..50b8221 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils Version: 6.9 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv2+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -21,6 +21,7 @@ Patch1: coreutils-futimens.patch Patch2: coreutils-ls-x.patch Patch3: coreutils-6.9-cp-i-u.patch Patch4: coreutils-6.9-du-ls-upstream.patch +Patch5: coreutils-dddoubleclose.patch # Our patches Patch100: coreutils-chgrp.patch @@ -94,6 +95,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch2 -p1 -b .ls-x %patch3 -p1 -b .cp-i-u %patch4 -p1 -b .du-ls +%patch5 -p1 -b .doubleclose # Our patches %patch100 -p1 -b .chgrp @@ -293,6 +295,10 @@ fi /sbin/runuser %changelog +* Tue Mar 11 2008 Ondrej Vasik 6.9-16 +- other way to keep user defined LS_COLORS(#430827) +- fixed harmless double close stdout in dd(#436368) + * Thu Mar 6 2008 Ondrej Vasik - 6.9-15 - rebuild / unspotted 6.9-14 build failure on ppc64