Re: Order of files with 'cp'

From: Tim Kientzle <kientzle_at_freebsd.org>
Date: Sat, 19 Nov 2005 11:33:54 -0800
Brian Candler wrote:
> I've noticed on FreeBSD-5.4 and -6.0 that the order in which 'cp' copies
> multiple files does not match the order they're given on the command line.
...
> I've had a look through the code, and it seems that cp calls fts_open() with
> the list of files in argv; fts_open then does a qsort() on the arguments,
> using the comparison function mastercmp() provided by cp:

My suggestion:  Have 'cp' call fts_open once for each
command-line argument, instead of giving fts_open the entire
argv list to muck with.

Requires faking up an argv array for each single item,
but that will be a lot easier than trying to fix fts.

Tim
Received on Sat Nov 19 2005 - 18:33:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:48 UTC