rpms/coreutils/devel coreutils-6.12-ls-constant_mem.patch, NONE, 1.1 coreutils.spec, 1.222, 1.223

Kamil Dudka (kdudka) fedora-extras-commits at redhat.com
Mon Aug 4 12:42:00 UTC 2008


Author: kdudka

Update of /cvs/extras/rpms/coreutils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6002

Modified Files:
	coreutils.spec 
Added Files:
	coreutils-6.12-ls-constant_mem.patch 
Log Message:
ls -U1 now uses constant memory

coreutils-6.12-ls-constant_mem.patch:

--- NEW FILE coreutils-6.12-ls-constant_mem.patch ---
From: Kamil Dudka <kdudka at redhat.com>
Date: Wed, 30 Jul 2008 12:31:50 +0000 (+0200)
Subject: ls -U1 now uses constant memory
X-Git-Url: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff_plain;h=8d974b00fbbc2025de63e1e6d54827648fefa1c4

ls -U1 now uses constant memory

When printing one name per line and not sorting, ls now uses
constant memory per directory, no matter how many files are in
the directory.
* ls.c (print_dir): Print each file name immediately, when possible.
---

diff --git a/src/ls.c b/src/ls.c
index 4b69f7d..a661c06 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2402,6 +2402,20 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
 #endif
 	      total_blocks += gobble_file (next->d_name, type, D_INO (next),
 					   false, name);
+
+	      /* In this narrow case, print out each name right away, so
+		 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)
+		{
+		  /* We must call sort_files in spite of
+		     "sort_type == sort_none" for its initialization
+		     of the sorted_file vector.  */
+		  sort_files ();
+		  print_current_files ();
+		  clear_files ();
+		}
 	    }
 	}
       else if (errno != 0)


Index: coreutils.spec
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils.spec,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -r1.222 -r1.223
--- coreutils.spec	24 Jul 2008 13:17:42 -0000	1.222
+++ coreutils.spec	4 Aug 2008 12:41:29 -0000	1.223
@@ -1,7 +1,7 @@
 Summary: The GNU core utilities: a set of tools commonly used in shell scripts
 Name:    coreutils
 Version: 6.12
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -28,6 +28,7 @@
 #Patch102: coreutils-6.10-longoptions.patch
 Patch103: coreutils-6.11-sparc-shafix.patch
 Patch104: coreutils-6.12-utimenstouchcp.patch
+Patch105: coreutils-6.12-dd-fullblock.patch
 
 # sh-utils
 Patch703: sh-utils-2.0.11-dateman.patch
@@ -54,8 +55,10 @@
 Patch950: coreutils-selinux.patch
 Patch951: coreutils-selinuxmanpages.patch
 Patch952: coreutils-6.11-matchpathconinstall.patch
-Patch953: coreutils-6.12-dd-fullblock.patch
+
+# ls enhancements (must be applied after SELINUX patches)
 Patch954: coreutils-6.12-ls-libcap.patch
+Patch955: coreutils-6.12-ls-constant_mem.patch
 
 BuildRequires: libselinux-devel >= 1.25.6-1
 BuildRequires: libacl-devel
@@ -115,6 +118,7 @@
 #%patch102 -p1 -b .longopt
 %patch103 -p1 -b .sparc
 %patch104 -p1 -b .utimensat
+%patch105 -p1 -b .dd-fullblock
 
 # sh-utils
 %patch703 -p1 -b .dateman
@@ -137,8 +141,10 @@
 #SELinux
 %patch950 -p1 -b .selinux
 %patch951 -p1 -b .selinuxman
-%patch953 -p1 -b .dd-fullblock
+
+# ls enhancements (must be applied after SELINUX patches)
 %patch954 -p1 -b .ls-libcap
+%patch955 -p1 -b .ls-constant_mem
 
 
 chmod a+x tests/misc/sort-mb-tests
@@ -323,6 +329,9 @@
 /sbin/runuser
 
 %changelog
+* Mon Aug 04 2008 Kamil Dudka <kdudka at redhat.com> - 6.12-8
+- ls -U1 now uses constant memory
+
 * Wed Jul 24 2008 Kamil Dudka <kdudka at redhat.com> - 6.12-7
 - dd: iflag=fullblock now read full blocks if possible
   (#431997, #449263)




More information about the fedora-extras-commits mailing list