1833858 Members
3103 Online
110063 Solutions
New Discussion

Problem with HP tar

 
Harri Pasanen
Occasional Advisor

Problem with HP tar

I've hit a very basic bug in HP tar. Apparently it has trouble supporting long pathnames. When I extract an archive with a path longer than 100 characters in it, I get the messages:

tar:
long-file-path-name
tar: ././@LongLink - cannot create

Where the long-file-path-name represents the long path.
I tried installing PHCO_20028 and PHCO_20416 hoping those would help, but nothing changed.

If I use GNU tar it works without problems.

I'm unsure where should I report this?
4 REPLIES 4
Alex Glennie
Honored Contributor

Re: Problem with HP tar

I think you'll find the following of interest :

The POSIX standard specifies the header for tar files. The standard
limits the length of tar filenames to be 256 characters: 100 chars
for the filename, 155 characters for the path, and a / separating the name and path.

So I would suggest this is normal behaviour, however if you still have concerns and wish to hear the latest, log a call via the ITRC or with your local Response Centre.
Dan Hetzel
Honored Contributor

Re: Problem with HP tar

Hi Harri,

Here is the tar header structure definition
as per 'man 4 tar'

struct {
char name[NAMSIZ]; (100)
char mode[MODE_SZ]; (8)
char uid[UID_SZ]; (8)
char gid[GID_SZ]; (8)
char size[SIZE_SZ]; (12)
char mtime[MTIME_SZ]; (12)
char chksum[CHKSUM_SZ]; (8)
char typeflag;
char linkname[NAMSIZ]; (100)
char magic[MAGIC_SZ]; (6)
char version[VERSION_SZ]; (2)
char uname[UNAME_SZ]; (32)
char gname[GNAME_SZ]; (32)
char devmajor[DEV_SZ]; (8)
char devminor[DEV_SZ]; (8)
char prefix[PREFIX_SZ]; (155)
} dbuf;

Unfortunately, you're hitting the limitations of posix tar.

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Tom Danzig
Honored Contributor

Re: Problem with HP tar

The -C switch causes tar to perform a chdir() to directory. This may help overcome the issue.
Harri Pasanen
Occasional Advisor

Re: Problem with HP tar

Thanks for the info, helped me to the right track.

After a session with xemacs looking at tar file bytes I found out what was wrong.

The problem was that GNU tar had been used to create the archive. Because of the long paths, GNU tar started to split the information about the filename into multiple headers. This works fine as long GNU tar is also the extracting tar. Unfortunately GNU tar does not do the splitting smartly in this case, and starts to use multiple headers already when 100 character path+file is encountered. My path + file always fits in 155+100, so remaking the tar with HP tar produces one that both GNU tar and HP tar can correctly deal with.