Re: cpio -l fails to revert to copy-mode

From: Tim Kientzle <kientzle_at_freebsd.org>
Date: Thu, 19 Jun 2008 22:24:24 -0700
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 ====
_at__at_ -545,6 +545,12 _at__at_
                             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);
         }
Received on Fri Jun 20 2008 - 03:24:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:32 UTC