From owner-freebsd-current@FreeBSD.ORG Fri Jun 20 09:06:20 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 D491E1065676; Fri, 20 Jun 2008 09:06:20 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from cpanel03.rubas-s03.net (cpanel03.rubas-s03.net [195.182.222.73]) by mx1.freebsd.org (Postfix) with ESMTP id 664728FC12; Fri, 20 Jun 2008 09:06:20 +0000 (UTC) (envelope-from gahr@FreeBSD.org) Received: from [213.142.183.219] (helo=gahrtop.localhost) by cpanel03.rubas-s03.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1K9cZU-00027J-Va; Fri, 20 Jun 2008 11:06:17 +0200 Message-ID: <485B7300.3070405@FreeBSD.org> Date: Fri, 20 Jun 2008 11:06:08 +0200 From: Pietro Cerutti Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.14 (X11/20080610) MIME-Version: 1.0 To: Tim Kientzle References: <485A9E7E.6050703@FreeBSD.org> <485B3F08.4010207@freebsd.org> In-Reply-To: <485B3F08.4010207@freebsd.org> X-Enigmail-Version: 0.95.6 OpenPGP: id=9571F78E; url=http://gahr.ch/pgp/ Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel03.rubas-s03.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - FreeBSD.org X-Source: X-Source-Args: X-Source-Dir: 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 09:06:20 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Tim Kientzle wrote: | 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); | } I had tried a similar patch myself locally, but that doesn't seem to work. Please look at this: | mount /dev/ad0s1a on / (ufs, local) devfs on /dev (devfs, local) /dev/ad0s1f on /home (ufs, local, soft-updates) /dev/ad0s1e on /usr (ufs, local, soft-updates) /dev/ad0s1d on /var (ufs, local) ....... | pwd /home/gahr/docs/Projects/FreeBSD/src/usr.bin/cpio | ls -al cpio.c - -rw-r--r-- 1 gahr gahr 24725 Jun 20 11:00 cpio.c | ./bsdcpio -dumpl /tmp/ cpio.c ^Dbsdcpio: Can't create '/tmp/cpio.c': Cross-device link: Cross-device link bsdcpio: Copying file instead bsdcpio: Couldn't stat "": No such file or directory | ls -al /tmp/cpio.c - -rw-r----- 1 gahr wheel 0 Jun 20 11:00 /tmp/cpio.c The file is created on the target directory, but it's empty... - -- Pietro Cerutti gahr@FreeBSD.org PGP Public Key: http://gahr.ch/pgp -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEAREKAAYFAkhbcv8ACgkQwMJqmJVx946JJgCglfx+8k8POdIwRGuWmyqpX+pq 94IAoLPvnoICES0m1zbcIHxkhA4vsVpX =Ni1m -----END PGP SIGNATURE-----