tech-userlevel archive

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

tar vs device special files



I ran into an issue with tar, recently, on a NetBSD 9.1 system.  I
created a tarball, containing device special files, with my tar and
then extracted it with the system tar.  The device special files all
ended up with major and minor numbers 0,0 on extract.

Looking at the tarball, I'm having trouble seeing what could be
responsible.

I created two test tarballs, containing just rwd0d from /dev, one with
my tar and one with the 9.1 tar.  Each one, of course, reads its own
tarball just fine, though the output format differs.  (tar listings
below are generated with $PROGRAM tvf -, with the tarball on stdin.)

Mine:

rw-r-----  0/5        0 Sep  2 12:58 2019 rwd0d character special device (3,3)

9.1 /bin/tar:

crw-r-----  0 root   operator  3,3 Sep  2  2019 rwd0d

Mine reads the OS's tarball fine as well

rw-r-----  0/5        0 Sep  2 12:58 2019 rwd0d character special device (3,3)

but the OS tar doesn't read my tarball correctly:

crw-r-----  0 0      5         0,0 Sep  2  2019 rwd0d

I'm having trouble seeing what's responsible, and in particular am
wondering whether this is my bug or /bin/tar's bug or what.  (It
doesn't help that I haven't managed to find a clear spec for tar
format; the closest I've found so far is a description of what pax, in
its (supposedly-)tar-compatible mode, is supposed to read/write.)

The 9.1 /bin/tar tarball (hexdump -C) is

00000000  72 77 64 30 64 00 00 00  00 00 00 00 00 00 00 00  |rwd0d...........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000060  00 00 00 00 30 30 30 36  34 30 20 00 30 30 30 30  |....000640 .0000|
00000070  30 30 20 00 30 30 30 30  30 35 20 00 30 30 30 30  |00 .000005 .0000|
00000080  30 30 30 30 30 30 30 20  31 33 35 33 33 32 34 35  |0000000 13533245|
00000090  30 37 34 20 30 31 32 36  35 35 00 20 33 00 00 00  |074 012655. 3...|
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000100  00 75 73 74 61 72 00 30  30 72 6f 6f 74 00 00 00  |.ustar.00root...|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000120  00 00 00 00 00 00 00 00  00 6f 70 65 72 61 74 6f  |.........operato|
00000130  72 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |r...............|
00000140  00 00 00 00 00 00 00 00  00 30 30 30 30 30 33 20  |.........000003 |
00000150  00 30 30 30 30 30 33 20  00 00 00 00 00 00 00 00  |.000003 ........|
00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00002800

whereas mine is

00000000  72 77 64 30 64 00 00 00  00 00 00 00 00 00 00 00  |rwd0d...........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000060  00 00 00 00 30 30 30 36  34 30 20 00 30 30 30 30  |....000640 .0000|
00000070  30 30 20 00 30 30 30 30  30 35 20 00 30 30 30 30  |00 .000005 .0000|
00000080  30 30 30 30 30 30 30 20  31 33 35 33 33 32 34 35  |0000000 13533245|
00000090  30 37 34 20 30 30 36 37  35 36 00 20 33 00 00 00  |074 006756. 3...|
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000140  00 00 00 00 00 00 00 00  00 30 30 30 30 30 33 20  |.........000003 |
00000150  00 30 30 30 30 30 33 20  00 00 00 00 00 00 00 00  |.000003 ........|
00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00002800

Except for the stuff at offsets 0x100-0x131, they look pretty close to
identical to me (the value at 0x94 is the header checksum), and that
stuff is, as far as I can tell, owner name strings (which I'm not
supplying, just using the numeric uid and gid values).  But the stock
9.1 tar seems to be taking the 000003 major and minor numbers as zero
for reasons I don't understand, since it understands its own,
apparently identical, major and minor numbers just fine.

Any ideas?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index