Subject: bin/25934: tar and hardlinks with long filenames
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dillo@netbsd.org>
List: netbsd-bugs
Date: 06/15/2004 16:20:27
>Number:         25934
>Category:       bin
>Synopsis:       tar and hardlinks with long filenames
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 15 14:21:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Dieter Baron
>Release:        NetBSD 2.0_BETA (June 3rd)
>Organization:
>Environment:
	
	
System: NetBSD wintermute 2.0_BETA NetBSD 2.0_BETA (WINTERMUTE) #3: Sat Jun  5 00:54:40 MEST 2004  root@wintermute:/usr/src/sys/arch/i386/compile/WINTERMUTE i386
Architecture: i386
Machine: i386
>Description:
	tar creates invalid archives for files with multiple hardlinks if at least one of them has a name of 100 characters or more.

both files have names with 100 characters and are linked to each other:

$ tar -tzf foo.tar.gz 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
tar: Invalid header, starting valid header search.
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
[Note that yyy.... is listed with 95 characters.]

$ tar -xzf foo.tar.gz 
tar: Invalid header, starting valid header search.
tar: Cannot link to xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx from yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy (No such file or directory)
[note that both xxx... and yyy... in the Cannot link message have 95 chars.]

$ ls
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


xxx... again has a name with 100 chars.

$ tar -tzf foo100-2.tar.gz             
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
tar: Invalid header, starting valid header search.
yy

$ tar -xzf foo100-2.tar.gz 
tar: Invalid header, starting valid header search.
tar: Cannot link to xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx from yy (No such file or directory)
$ ls
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


xxx. again has a name with 100 chars.

$ tar -tzf foo2-100.tar.gz 
aa
tar: Invalid header, starting valid header search.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[note that xxx... is listed with 99 chars.]

$ tar -xvzf ../foo2-100.tar.gz 
aa
tar: Invalid header, starting valid header search.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
tar: ustar vol 1, 2 files, 10240 bytes read, 0 bytes written in 1 secs (10240 bytes/sec)
[note that xxx... is listed with 99 chars.]

$ ls                               
aa
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[note that xxx... is extracted with 99 chars.]


>How-To-Repeat:
  See above.  If you have perl installed, the following might
help in creating files with long names:
	touch `perl -e 'print "x"x100 . "\n";'`
>Fix:
	non known.
>Release-Note:
>Audit-Trail:
>Unformatted: