ron minnich <rminnich(a)gmail.com> writes:
I have a directory, t:
ronsexcllentmbp:t rminnich$ ls -li
total 0
23801442 -rw-r--r-- 1 rminnich wheel 0 Jun 26 20:21 a
23801443 -rw-r--r-- 2 rminnich wheel 0 Jun 26 20:21 b
23801443 -rw-r--r-- 2 rminnich wheel 0 Jun 26 20:21 c
note that b and c are the same inode.
let's make a cpio.
ronsexcllentmbp:t rminnich$ cpio -o >../t.cpio
a
b
c
^D
1 block
what's in it?
ronsexcllentmbp:t rminnich$ cpio -ivt < ../t.cpio
-rw-r--r-- 1 rminnich wheel 0 Jun 26 20:21 a
-rw-r--r-- 2 rminnich wheel 0 Jun 26 20:21 b
-rw-r--r-- 2 rminnich wheel 0 Jun 26 20:21 c link to b
"c link to b"? wtf? Who thought that was a good idea? because ...
ronsexcllentmbp:t rminnich$ touch 'c link to b'
ronsexcllentmbp:t rminnich$ ls -l
total 0
-rw-r--r-- 1 rminnich wheel 0 Jun 26 20:21 a
-rw-r--r-- 2 rminnich wheel 0 Jun 26 20:21 b
-rw-r--r-- 2 rminnich wheel 0 Jun 26 20:21 c
-rw-r--r-- 1 rminnich wheel 0 Jun 26 20:22 c link to b
This is a feature of libarchive (cpio since FreeBSD 8), note that
without -v it prints the actual names as tools expect it.
(Similarly, symlinks are printed as "c -> b".)
More fun is that it's not able to extract only "c", even tho the ASCII
cpio format stores hard links by duplicating the data...
--
Leah Neukirchen <leah(a)vuxu.org>
https://leahneukirchen.org/