On Sun, 2005-Nov-20 21:56:58 -0500, Garance A Drosihn wrote: >Apparently this "sorting optimization" in `cp' goes all the way >back to the original version of `cp' from 1994. Looking back further, it appears this (mis)feature was introduced in 4.4BSD. V6 only allows one file. V7 through 4.3BSD (including reno and tahoe) all step through argv an element at a time. >*Assuming* the comment is correct, and that there *is* some >performance benefit by copying files before directories, Since it's fairly easy to disable the "optimisation", it would be fairly easy to check cp both with and without the "optimisation" - if someone can suggest a reasonable test. If the comment is correct, a recursive copy of a large directory comprising a mixture of a files and other directories would seem to be the worst case. >I think a better fix might be to add an option to fts_open() which >tells it to "process files before directories" (or visa-versa) in >any given directory. Then `cp' could turn on that bit, and avoid >the fake sort. Alternatively, make two passes through argv - on the first pass, copy all the directories, on the second pass, copy all the files. -- Peter JeremyReceived on Mon Nov 21 2005 - 05:45:12 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:48 UTC