Date: Thu, 19 Jun 2008 22:24:24 -0700 From: Tim Kientzle <kientzle@freebsd.org> To: Pietro Cerutti <gahr@freebsd.org> Cc: Doug Barton <dougb@freebsd.org>, FreeBSD Current <current@freebsd.org> Subject: Re: cpio -l fails to revert to copy-mode Message-ID: <485B3F08.4010207@freebsd.org> In-Reply-To: <485A9E7E.6050703@FreeBSD.org> References: <485A9E7E.6050703@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?485B3F08.4010207>