extracting tar files with absolute pathnames relatively

Ray E Saddler III ray3rd at ssc-vax.UUCP
Fri Apr 28 06:20:55 AEST 1989


In article <202 at psgdc>, rg at psgdc (Dick Gill) writes:
> In article <2620 at ssc-vax.UUCP> ray3rd at ssc-vax.UUCP (Ray E Saddler III) writes:
> >In article <1501 at cfa205.cfa250.harvard.edu>, todd at cfa250.harvard.edu (Todd Karakashian) writes:
> >> I am in posession of tapes containing tarfiles with absolute
> ...
> >
> >Make a link (symbolic in my instance) in the /usr directory.  The
> >link name would be 'foo', and would simply point to /temp.
> >
> >It works quite nicely.
> >
> This sounds to simple and straightforward to be true. Walk me
> through this step by step, please.
> 
> Thanks.

First of all, we are concerned with remapping absolute pathnames in
a 'tar' file (be it tape or diskfile) to a filesystem.

The slight of hand is in creating a false pathname in the filesystem
which will redirect the directory names in the tar image as they are
extracted to disk.

For the sake of example, my home directory on our VAX is
/user4/ray3rd, but on my workstation, the home directory is
/usr/user/ray.  If I create a tar file on the VAX, I'll need to
create a bogus /user4/ray3rd on my workstation if I want to extract
the files directly onto my home directory.

Sample VAX tarfile:

rwxr-xr-x1221/737      0 Jun 29 09:09 1988 /user4/ray3rd/block/
rw-r--r--1221/737     96 Jun 29 09:08 1988 /user4/ray3rd/block/Makefile
rw-r--r--1221/737   1401 Jun 29 09:08 1988 /user4/ray3rd/block/block.c
rw-r--r--1221/737  17112 Jun 29 09:08 1988 /user4/ray3rd/block/data.c

Now I go to my workstation and:

cs2860 ray> su root
Password: 

cs2860 ray> mkdir /user4

cs2860 ray> ln -s /usr/user/ray /user4/ray3rd

cs2860 ray> chown ray /user4/ray3rd

cs2860 ray> ls -al /user4
total 3
drwxrwxrwx  2 root          512 Apr 27 09:57 .
drwxr-xr-x 16 root         1024 Apr 27 09:53 ..
lrwxrwxrwx  1 ray            13 Apr 27 09:57 ray3rd -> /usr/user/ray

cs2860 ray> cd /user4/ray3rd

cs2860 ray> pwd
/usr/user/ray

cs2860 ray> tar -xvf /tmp/sampletar
x /user4/ray3rd/block/Makefile, 96 bytes, 1 tape blocks
x /user4/ray3rd/block/block.c, 1401 bytes, 3 tape blocks
x /user4/ray3rd/block/data.c, 17112 bytes, 34 tape blocks

cs2860 ray> ls -al /user4/ray3rd/block/* /usr/user/ray/block/*
-rw-r--r--  1 1221           96 Jun 29  1988 /user4/ray3rd/block/Makefile
-rw-r--r--  1 1221         1401 Jun 29  1988 /user4/ray3rd/block/block.c
-rw-r--r--  1 1221        17112 Jun 29  1988 /user4/ray3rd/block/data.c
-rw-r--r--  1 1221           96 Jun 29  1988 /usr/user/ray/block/Makefile
-rw-r--r--  1 1221         1401 Jun 29  1988 /usr/user/ray/block/block.c
-rw-r--r--  1 1221        17112 Jun 29  1988 /usr/user/ray/block/data.c

And there we have it.  The next step would be to CHange OWNership of
the new files to 'ray' since I have different UID's on each system.

Simple, eh?

[Sorry to use so much bandwidth, but it seemed convenient to
 followup rather than directly mail to him!]
-- 
Ray E. Saddler III       |    __  __ __       __ |          UseNet
Boeing Aerospace         |   / / / //   //| //   | uw-beaver!ssc-vax!ray3rd
P.O. Box 3999 m.s. 3R-05 |  /-< / //-  // |// _  |         PhoneNet
Seattle, Wa.  98124  USA | /__//_//__ //  //__/  |      1+206-657-2824



More information about the Comp.unix.questions mailing list