Date: Fri, 20 Jun 2008 11:06:08 +0200 From: Pietro Cerutti <gahr@FreeBSD.org> To: Tim Kientzle <kientzle@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: <485B7300.3070405@FreeBSD.org> In-Reply-To: <485B3F08.4010207@freebsd.org> References: <485A9E7E.6050703@FreeBSD.org> <485B3F08.4010207@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
-----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-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?485B7300.3070405>