Date: Sun, 20 Nov 2005 20:50:26 +0000 From: Brian Candler <B.Candler@pobox.com> To: Tim Kientzle <kientzle@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: Order of files with 'cp' Message-ID: <20051120205026.GA19791@uk.tiscali.com> In-Reply-To: <4380DC1A.9030201@freebsd.org> References: <20051116161540.GB4383@uk.tiscali.com> <437F7E22.5050800@freebsd.org> <20051120192914.GC19572@uk.tiscali.com> <4380DC1A.9030201@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 20, 2005 at 12:27:06PM -0800, Tim Kientzle wrote: > >Erm, but that just undoes the reason for calling fts_open with mastercmp in > >the first place, which is to get it to pick files before directories (or > >vice versa, as its behaviour seems to be) as an 'optimisation'. > > Why is that an optimization? I'm only regurgitating what is written in /usr/src/bin/cp/cp.c: /* * mastercmp -- * The comparison function for the copy order. The order is to copy * non-directory files before directory files. The reason for this * is because files tend to be in the same cylinder group as their * parent directory, whereas directories tend not to be. Copying the * files first reduces seeking. */ > I thought the whole point of this thread was that users > expect utilities to process the command-line arguments > in the order they're given. That wasn't the point I made at the start of the thread - somebody else brought up POLA - although I would be happy for cp to process command-line arguments strictly in the order they are given (in which case, you just replace mastercmp with NULL when calling fts_open) I suggested that if the above 'optimisation' makes sense, it should still be possible to make cp copy arguments in the order given if they are all files or all directories. I gave some suggested ways of achieving this. Regards, Brian.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051120205026.GA19791>