From owner-freebsd-current@FreeBSD.ORG Fri Jun 20 05:24:27 2008 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2170B106566B; Fri, 20 Jun 2008 05:24:27 +0000 (UTC) (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 E8EB38FC14; Fri, 20 Jun 2008 05:24:26 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from [10.0.0.128] (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id m5K5OOtv045040; Thu, 19 Jun 2008 22:24:24 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <485B3F08.4010207@freebsd.org> Date: Thu, 19 Jun 2008 22:24:24 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pietro Cerutti References: <485A9E7E.6050703@FreeBSD.org> In-Reply-To: <485A9E7E.6050703@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Doug Barton , FreeBSD Current Subject: Re: cpio -l fails to revert to copy-mode 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: Fri, 20 Jun 2008 05:24:27 -0000 Pietro Cerutti wrote: > ~> cpio -dumpl /tmp/ > test > cpio: Can't create '/tmp/test': Cross-device link: Cross-device link Try the following patch and let me know if it works for you. The error messages are a little funky, but the behavior seems to roughly follow GNU cpio. I'm tempted to clear the link option here so that after the first EXDEV error, cpio won't even bother trying to link subsequent files. That should be slightly more efficient in the common case (where you're copying a whole tree across devices) but will change behavior in the very uncommon case where the target is partially on the same device and partially on a different device. This would differ from GNU cpio, which spits out the same warning for every cross-device link. ==== src/usr.bin/cpio/cpio.c ==== @@ -545,6 +545,12 @@ archive_error_string(cpio->archive)); if (r == ARCHIVE_FATAL) exit(1); +#ifdef EXDEV + if (r != ARCHIVE_OK && archive_errno(cpio->archive) == EXDEV) { + cpio_warnc(0, "Copying file instead"); + archive_entry_set_hardlink(entry, NULL); + } else +#endif return (0); }