tar truncating file names when tarfile is transferred from Linux to Unix (Solaris)

1

What steps I did:

On a Linux machine (RHEL-6): tar -cvf <tarname.tar>.

On a Unix machine (Solaris-10): sftp <linuxUser@server.com> and ftp the tarfile to the Unix system.

Now untar on Unix: tar -xvf <tarname.tar>.

On extracting the files, I see some of the files getting created with truncated file names, as below:

bash-3.2$ ls -lt 
total 48
-rw-r--r--   1 user  group        454 Jan 13 01:53 FileNam

Instead of FileName.txt, I get FileNam.

tar -tvf <tarname.tar> also displays truncated filenames.

How can I extract the tar file properly after I have transferred it from Linux to Unix, not via Windows?

Note: The tarfile transferred on Unix has full file names; it is just on extracting the tarfile that the files get created with truncated file names.

user685398

Posted 2017-01-13T12:16:33.680

Reputation: 11

Is there a chance that the full path is longer than 255 characters? – jcbermu – 2017-01-13T12:23:48.980

2Solaris tar: The full pathname length cannot exceed 255 characters. The file name (or leaf) length cannot exceed 100 characters. The prefix of the pathname cannot exceed 155 characters. Is any of that the case? Are you seeing the truncated names on the Linux machine using tar tvf <file>? – Seth – 2017-01-13T12:31:12.080

@Seth Note that those limitations are from the POSIX standard for tar archives. GNU tar produces archives that do not follow that standard. Just Google "Jeorg Schilling GNU tar" for some epic and substantial rants about GNU tar breaking the POSIX standard over the last couple of decades. Here's just one: http://unix.derkeiler.com/Newsgroups/comp.unix.solaris/2003-08/1899.html Note that Schilling knows the history of GNU tar, and the specific standards that it breaks.

– Andrew Henle – 2017-01-14T12:12:08.953

Quite interesting to know. From my personal user experience I'd guess that gnu tar is more widely used by now and a such would be the defacto standard even if it's not (following) an official one with certain things it does. But just as that newsgroup posting shows there seems to be a lot of history to it so I might be wrong but ultimately it seems to be a matter of opinion and wouldn't help to fix the actual issue. The solution seems to be to use gnu tar. From that newsgroup posting it seems the OP should've received some warnings during unpacking about some invalid/unkown headers. – Seth – 2017-01-14T22:12:06.593

Answers

2

Francis's answer regarding issues with interoperability for tar on Solaris and Linux is correct.

You can install gtar (GNU tar) from the sunfreeware site if you can find it – Google "sunfreeware gnu tar".

Alternatively, you can use cpio, the most portable file archiving option between *nixes. I've successfully in the past gone between AIX, Linux, Solaris, HP-UX ↔ Linux using cpio when I've not had access to gtar.

Munkeh72

Posted 2017-01-13T12:16:33.680

Reputation: 121

Actually, the other answer is backwards as to where the incompatibility comes from. – Andrew Henle – 2017-01-14T12:36:02.607