From owner-freebsd-current@FreeBSD.ORG Mon Nov 21 06:45:12 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2052616A41F for ; Mon, 21 Nov 2005 06:45:12 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CDAA43D45 for ; Mon, 21 Nov 2005 06:45:11 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail01.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id jAL6j8JL013754 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 21 Nov 2005 17:45:08 +1100 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1]) by cirb503493.alcatel.com.au (8.12.10/8.12.10) with ESMTP id jAL6j0Hh004260; Mon, 21 Nov 2005 17:45:07 +1100 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost) by cirb503493.alcatel.com.au (8.12.10/8.12.9/Submit) id jAL6j018004256; Mon, 21 Nov 2005 17:45:00 +1100 (EST) (envelope-from pjeremy) Date: Mon, 21 Nov 2005 17:44:59 +1100 From: Peter Jeremy To: Garance A Drosihn Message-ID: <20051121064459.GB1395@cirb503493.alcatel.com.au> References: <20051116161540.GB4383@uk.tiscali.com> <437F7E22.5050800@freebsd.org> <20051120192914.GC19572@uk.tiscali.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc Cc: freebsd-current@freebsd.org Subject: Re: Order of files with 'cp' X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2005 06:45:12 -0000 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 Jeremy