]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cp: use far less memory in some cases
authorJim Meyering <meyering@redhat.com>
Wed, 19 Nov 2008 18:36:45 +0000 (19:36 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 20 Nov 2008 09:21:52 +0000 (10:21 +0100)
commit3ece0355d52e41a1b079c0c46477a32250278c11
treeea24ea4aae7129a936c291f29ee7b2724bed6d5c
parent1760ade090cbf8c854c1033399d51ff4fdde3ae0
cp: use far less memory in some cases

cp --link was "remembering" many name,dev,inode triples unnecessarily.
cp was doing the same, even without --link, for every directory in the
source hierarchy, while it can do its job with entries merely for the
command-line arguments.  Prompted by a report from Patrick Shoenfeld.
Details <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15081>.
* src/copy.c (copy_internal): Refrain from remembering
name,dev,inode for most files, when invoked via cp --link.
Record an infloop-avoidance triple for each directory specified
on the command line, not for each directory in the source tree.
Don't record a dir-triple when x->hard_link is set.
* NEWS (Buf fixes): Mention it.
* tests/cp/link-heap: New file.  Test for cp's lowered memory usage.
* tests/Makefile.am (TESTS): Add link-heap.
NEWS
src/copy.c
tests/Makefile.am
tests/cp/link-heap [new file with mode: 0755]