rpms/coreutils/F-8 coreutils-dddoubleclose.patch, NONE, 1.1 coreutils-colorls.csh, 1.5, 1.6 coreutils-colorls.sh, 1.4, 1.5 coreutils.spec, 1.185, 1.186

Ondrej Vasik (ovasik) fedora-extras-commits at redhat.com
Tue Mar 11 17:17:48 UTC 2008


Author: ovasik

Update of /cvs/extras/rpms/coreutils/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31382

Modified Files:
	coreutils-colorls.csh coreutils-colorls.sh coreutils.spec 
Added Files:
	coreutils-dddoubleclose.patch 
Log Message:
fixed harmless double close stdout in dd, other way to keep user defined LS_COLORS

coreutils-dddoubleclose.patch:

--- NEW FILE coreutils-dddoubleclose.patch ---
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);
 


Index: coreutils-colorls.csh
===================================================================
RCS file: /cvs/extras/rpms/coreutils/F-8/coreutils-colorls.csh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- coreutils-colorls.csh	4 Mar 2008 12:54:13 -0000	1.5
+++ coreutils-colorls.csh	11 Mar 2008 17:17:17 -0000	1.6
@@ -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


Index: coreutils-colorls.sh
===================================================================
RCS file: /cvs/extras/rpms/coreutils/F-8/coreutils-colorls.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- coreutils-colorls.sh	19 Feb 2008 12:34:54 -0000	1.4
+++ coreutils-colorls.sh	11 Mar 2008 17:17:18 -0000	1.5
@@ -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 @@
   # 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


Index: coreutils.spec
===================================================================
RCS file: /cvs/extras/rpms/coreutils/F-8/coreutils.spec,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -r1.185 -r1.186
--- coreutils.spec	6 Mar 2008 12:46:01 -0000	1.185
+++ coreutils.spec	11 Mar 2008 17:17:18 -0000	1.186
@@ -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 @@
 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 @@
 %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 @@
 /sbin/runuser
 
 %changelog
+* Tue Mar 11 2008 Ondrej Vasik <ovasik at redhat.com> 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 <ovasik at redhat.com> - 6.9-15
 - rebuild / unspotted 6.9-14 build failure on ppc64
 




More information about the fedora-extras-commits mailing list