Summary: Want to read a POSIX tar archive (also:" tar file portability between HP-UX and Solaris")

From: Randy J. Parker (parker@atlanta.com)
Date: Tue Dec 29 1998 - 17:27:35 CST


Original Problem Statement:
Solaris can't read a tar archive produced on HP-UX.

Solution:
Wrong problem statement.
Solaris "tar" DOES read the default (POSIX) HP-UX tar archives without
trouble.
The problem arose because the file was NOT really transferred in binary mode
ftp.

Detailed Explanation:
The people who sent me the file passed it through a commercial PC ftp
program in "binary mode". Apparently, their vendor's ftp recognized that it
was an uncompressed tar file, and converted it to DOS format. (Why should a
program obey a mere user's request for "binary mode" when the program
recognizes that a Unix tarfile is being sent to DOS?) Using the command line
ftp client in Windows would NOT have resulted in the gratuitous conversion.
It believes you when you say "bin".

This conversion replaced the unix line delimiter ("/n", or "newline") with
the usual DOS pair of line delimiters: /r/n). Realizing this, the fellows
at the remote site applied the unix program "dos2unix" to reverse the
conversion. Unfortunately, this did not restore the original file exactly.
"dos2unix" stripped out ALL "/r" characters, including those that were
embedded in the binary file without flanking newlines.

Even worse, they didn't mention this step to me because they assumed it had
successfully restored the original file. Aware of the traditional Solaris
"sum" error (see gnu tar texinfo pages), and uncertain of whether HP-UX
10.20 continued to be compatible with the old Sun "sum" bug, I did not
checksum the files because I wasn't sure what a discrepancy would prove. If
only I had known two weeks ago that gnu textutils "md5sum" or the bundled
(on Sun and HP) POSIX "cksum" are both good solutions!(By the way, there was
no checksum problem between HP-UX 10.20 and the most recent three versions
of Solaris, 2.5.1, 2.6, 2.7, SPARC and x86. My concern was unwarranted.)

Recovering the Data:
Anyhow, I restored the archive with the following hack, which strips out
ONLY the carriage returns that are paired with newlines:

http://www.mobiledyne.com/pub (20 line C program source)

Thanks to:
Francois Pinard (author of gnu "tar") Montreal
Joerg Schilling (author of "star") Berlin
Bruce Zimmer
Michael Wang
Davin Milun
Peter Marelas
John Pezzano
Auteria Wally Winzer, Jr.
Philip Bruce
J.Kell Canty
Lewis E. Wolfgang
Justin Clift
Bo Thide

Although solving my problem did not require the following programs, they are
both solid and have excellent documentation:

gnu tar:
ftp://sunsite.unc.edu/pub/gnu/ or any other sunsite, or
ftp://prep.ai.mit.edu/pub/gnu/

star:
http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/
index.html
(Joerg has written several other handy programs, available at this site...)

Thanks to all who lent a hand.
I apologize for wasting your time with my mis-diagnosed statement of the
problem!

Randy J. Parker
MobileDyne Systems, Inc.
Atlanta, GA
http://www.mobiledyne.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:54 CDT