From owner-freebsd-current@FreeBSD.ORG Sat Nov 19 19:33:56 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 5C17716A421 for ; Sat, 19 Nov 2005 19:33:56 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF5E843D4C for ; Sat, 19 Nov 2005 19:33:55 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from freebsd.org (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id jAJJXsOZ009747; Sat, 19 Nov 2005 11:33:55 -0800 (PST) (envelope-from kientzle@freebsd.org) Message-ID: <437F7E22.5050800@freebsd.org> Date: Sat, 19 Nov 2005 11:33:54 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031006 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brian Candler References: <20051116161540.GB4383@uk.tiscali.com> In-Reply-To: <20051116161540.GB4383@uk.tiscali.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: Sat, 19 Nov 2005 19:33:56 -0000 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