]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r282482: cp: Remove fts sorting.
authorjilles <jilles@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 14 May 2015 19:32:13 +0000 (19:32 +0000)
committerjilles <jilles@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 14 May 2015 19:32:13 +0000 (19:32 +0000)
commit6e49877afaef87df7db792426e056638d3cd5708
tree729cf4d0b349e13de2422424dedffd62ea378311
parent8c88bc976e6d3b84c7e4741ddf1e03513874a869
MFC r282482: cp: Remove fts sorting.

In an attempt to improve performance, cp reordered directories first
(although the comment says directories last). This is not effective with new
UFS layout policies.

The sorting reorders multiple arguments passed to cp, which may be
undesirable.

Additionally, the comparison function does not induce a total order. Per
POSIX, this causes undefined behaviour in qsort().

NetBSD removed the sorting in 2009.

On filesystems that return directory entries in hash/btree order, sorting by
d_fileno before statting improves performance on large directories. However,
this can only be implemented in fts(3).

PR: 53475
Reviewed by: bde (in 2004)

git-svn-id: svn://svn.freebsd.org/base/stable/9@282917 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
bin/cp/cp.c