SUMMARY: Question on tar + another question

From: Sizemore, Joanna <>
Date: Tue May 06 2003 - 08:50:23 EDT
Thanks to everyone who took time to respond to my question on stripping the leading "/" from a tar extract.  Consensus is that it is not possible with standard tar, but is the default with GNUtar (which is what I used).  Biggest thing I learned was to never use absolute paths when creating tape archives...  Other suggestions were to use 'chroot' to re-direct output, and the 'pax' command (which I could not get to work).

This leads to a new question...why does gnutar not want to release the tape drive?  I left it sit for over an hour hoping that it would finish reading the rest of the tape on it's own and return to a command prompt.  I finally had to control C out of it.  Has anyone else seen this behavior with gnutar?

Following are typical of the responses I received:

The best way is to use relative pathnames when creating the tar archive
in the first place.
Both Joerg Schilling's "star" and GNU tar ignore leading slashes by
default; you could use one of those.
I "think" gnutar will allow you to do what you want:
select Sparc/Solaris 7 and scroll down to tar 1.13.19
Either use GNU tar, or do a chroot(1M).
GNU tar is good to have around in any case, but if you can't get it
quickly, the chroot(1M) man page has a "de-absolute tar path"
You may want to look at pax(1) instead. Take a look at the -i and -s
options for a start.
pax -r -s '!/path_on_tape/filename!newpath/newfilename!' \
	-f /dev/rmt/0 /path_on_tape/filename
Type "man pax" for more details.
pax -r -f foo.tar  -s ';oldpath;newpath;'  /oldpath/fileyouwant
If all you need is to strip the leading /, 
    pax -r -f /dev/rmt/0 -s ';//*;;' /path_on_tape/filename

+ + + + + + + + + + + + + + + + + + + + + + + + +
PRIVILEGED MESSAGE.   Unless noted otherwise in the above message, this email is confidential, intended only for the named recipient(s) above and may contain information that is a trade secret, proprietary, privileged, sensitive or confidential information.  Unintended transmission shall not constitute a waiver of confidentiality or any other privilege.  If you have received this message in error, or are not the named or intended recipient(s), please notify the sender or 812-273-8612 and delete this email message and any attachments from your workstation or network mail system. 
 + + + + + + + + + + + + + + + + + + + + + + + + +
sunmanagers mailing list
Received on Tue May 6 08:50:19 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:14 EST