Red Hat Bugzilla – Bug 54827
Invalid tar files caused by multiply-linked sockets
Last modified: 2007-04-18 12:37:40 EDT
Description of Problem:
When tar encounters a socket it ignores it. However, it appears to do this
*after* storing an entry for the inode number in its lookup table. If it
then encounters additional links to the same inode, it just stores them as
hard links to the original filename. But since it ignored the original
filename, attempts to unpack the tar file will fail, as the links refer to
a missing socket.
The check for the inode being a socket should occur before the inode/path
mapping is inserted in the lookup table; then later instances of the same
inode will also be ignored.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. cd /dev; ln log log2
2. tar cf /tmp/sock.tar log log2 null
[root@qa55 /dev]# tar cf /tmp/sock.tar log log2 null
tar: log: socket ignored
[root@qa55 /dev]# tar tvf /tmp/sock.tar
-rw-rw-rw- root/root 0 2001-10-17 16:04:43 log2 link to log
crw-rw-rw- root/root 1,3 2001-03-23 20:37:44 null
Two 'socket ignored' messages and a valid tar file containing neither log
I've fixed it in 1.13.25-2.