[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1358: tar can't extract device numbers stored using cpio -Hustar



Package: tar
Version: 1.11.8-1

chiark:~/junk> cd /dev
chiark:/dev> echo null | cpio -Hustar -O/u/ian/junk/t -vo
null
3 blocks
chiark:/dev> tar vvtf ~/junk/t
tar: Blocksize = 3 records
crw-rw-rw- 0/3             0,0 Mar 30 21:18 1995 null
chiark:/dev> cd ~/junk/
chiark:~/junk> really tar vvxf t
tar: Blocksize = 3 records
crw-rw-rw- 0/3             0,0 Mar 30 21:18 1995 null
chiark:~/junk> ll null
crw-rw-r--   1 root     sys        0,   0 Mar 30 21:18 null
chiark:~/junk> ll /dev/null
crw-rw-rw-   1 root     sys        1,   3 Mar 30 21:18 /dev/null
chiark:~/junk> cpio -tv -Ft
crw-rw-rw-   1 root     sys        1,   3 Mar 30 21:18 null
2 blocks
chiark:~/junk> rm null
rm: remove `null', overriding mode 0664? y
chiark:~/junk> really cpio -iv -Ft
null
2 blocks
chiark:~/junk> ll null
crw-rw-rw-   1 root     sys        1,   3 Sep 14 19:38 null
chiark:~/junk> gzip -9v <t | uuencode t.gz
 94.6%
begin 664 t.gz
M'XL(`!]V6#`"`\LKS<EAH#%0,#(P,S-38%```0,H;0REH6*FYL9F9H:&!F:&
M0'%#`Q-S<P4&8P8Z@-+BDL0B!@.#HOS\$GSJBBN+\7L2!`P1GAL%HV`4C()!
*#@#(#'K>``8```8Z
`
end
chiark:~/junk>

This is a bug in tar, not cpio.  cpio writes the device number fields
using something resembling what snprintf(buf,8,"%7o\0",number) would
do if null weren't the string terminator.  (At least, I think it's
octal.)  This kind of nastiness in tar headers is common, and tar
needs to cope with it.

Ian.


Reply to: