-----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 ==== | _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); | } 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_at_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-----Received on Fri Jun 20 2008 - 07:06:20 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:32 UTC