Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 1996 14:41:23 +1100 (EST)
From:      David Dawes <dawes@landfill.physics.usyd.edu.au>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        dawes@physics.usyd.edu.au
Subject:   gnu/1992: Gnu tar has problems with hard links to files with long names
Message-ID:  <199611110341.OAA15671@landfill.physics.usyd.edu.au>
Resent-Message-ID: <199611110350.TAA09434@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1992
>Category:       gnu
>Synopsis:       Gnu tar has problems with hard links to files with long names
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 10 19:50:02 PST 1996
>Last-Modified:
>Originator:     David Dawes
>Organization:
University of Sydney, Australia
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

>Description:

Gnu tar has problems creating an archive which contains a file with a hard
link to another file which has a long (>=100 char) name.  When listing such
an archive, the name of the link is truncated to 99 characters, and when
extracting such an archive, an error is reported because it is trying to
create a hard link to a file which doesn't exist.

>How-To-Repeat:

    mkdir -p 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789
    mkdir -p 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/xx
    echo stuff > 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/file
    ln 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/file 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/xx/link
    tar cf test.tar 123456789

Then listing with 'tar vtf test.tar' gives:

-rw-r--r-- dawes/theory      0 Nov 11 14:35 1996 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/file link to 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789

And attempting to extract gives:

tar: Could not link 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/file to 123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789/123456789 : No such file or directory

>Fix:
	
The following patch appears to fix the problem, which is seems to
be a long-standing problem with gnu tar.  I'm planning to send this
patch to the maintainer of gnu tar.

Index: create.c
===================================================================
RCS file: /home/cvs/src/gnu/usr.bin/tar/create.c,v
retrieving revision 1.3
diff -c -r1.3 create.c
*** create.c	1995/06/26 06:24:37	1.3
--- create.c	1996/11/11 03:22:52
***************
*** 313,319 ****
  		    }
  		  link_name++;
  		}
! 	      if (link_name - lp->name >= NAMSIZ)
  		write_long (link_name, LF_LONGLINK);
  	      current_link_name = link_name;
  
--- 313,319 ----
  		    }
  		  link_name++;
  		}
! 	      if (strlen(link_name) >= NAMSIZ)
  		write_long (link_name, LF_LONGLINK);
  	      current_link_name = link_name;
  
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611110341.OAA15671>