On Aug 23 13:33:37, Philip Guenther wrote: > On Thu, Aug 23, 2012 at 12:32 PM, Jan Stary <[email protected]> wrote: > > cp.c says: > > > > /* > > * 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. > > */ > ... > > Doesn't the code actually do the opposite? > > If 'a' is a directory, it comes first? > > Yep. Nice catch. > > > > Should that be FTS_F? > > I think it's correct to do the test against FTS_D, it just should > return them in the other direction to do what the comment says.
Actually, that still doesn't seem quite right: why would it ever return -1 for a directory? Shouldn't it return -1 when 'a' is a file and 'b' is a directory, return +1 in the opposite case, and return 0 in all other cases? Or should it just return +1 for FTS_D to push directories to the back? Also, does the above also apply to symlinks (FTS_SL) when working as cp -P?
