Xref: utzoo comp.unix.wizards:6392 comp.bugs.4bsd:691 Path: utzoo!mnetor!uunet!tektronix!sequent!phil From: phil@sequent.UUCP (Phil Hochstetler) Newsgroups: comp.unix.wizards,comp.bugs.4bsd Subject: Re: Tar and absolute pathnames Message-ID: <3195@sequent.UUCP> Date: 3 Feb 88 19:34:34 GMT References: <2561@encore.UUCP> <1412@quacky.mips.COM> <3990@hoptoad.uucp> Reply-To: phil@sequent.UUCP (Phil Hochstetler) Organization: Sequent Computer Systems, Beaverton, OR Lines: 28 I once ran into a tape written this way and devised a quick filter that gets around this problem. Basically, you can process the tar header blocks moving the pathname up to get rid of the leading '/' but have to be sure the header checksum is correct. My quick solution is to move the '/' to the end of the pathname array, after the terminating null character. This means you can then do: tarfix < absolute.archive.tar | tar -xpvBf - to extract the archive correctly. Code follows: ---- tarfix.c main() { char fixbuf[512]; while (read(0, fixbuf, sizeof (fixbuf)) == sizeof (fixbuf)) { if (fixbuf[0] == '/' && fixbuf[99] == 0) { strcpy(fixbuf, &fixbuf[1]); fixbuf[99] = '/'; } write(1, fixbuf, sizeof (fixbuf)); } } ---- Phil Hochstetler Sequent Computer Systems Beaverton, Oregon