Using "tar" with "-s"

Using "tar" with "-s"

Post by Ted Pers » Fri, 24 May 1991 03:26:25



Hi,

I have been trying to use the "tar" command on AIX 3003 of the IBM
RS/6000 to copy a file system from the local disk of my workstation
into the file space which we have under the Andrew File System (AFS).
According to the documentation provided with "tar", the "-s" option
tells "tar" that during the extract procedure, if there exists a
hard link to a file that you cannot create, attempt to create a
symbolic link instead.  This is especially important with AFS,
since AFS prohibits hard links which span directories.

Here's an example of the problem: on the RS/6000 /usr/ucb/vi is
a hard link to /usr/bin/vi, as seen in

% ls -li /usr/ucb/vi /usr/bin/vi
 2195 -r-xr-xr-x   9 bin      bin       214313 Nov 09 1990  /usr/bin/vi
 2195 -r-xr-xr-x   9 bin      bin       214313 Nov 09 1990  /usr/ucb/vi

Both have the same inode, 2195.  But when I look at what "tar" does when
it copies it into my AFS space:

% ls -li /afs/alw.nih.gov/unix/rs_aix31/usr/ucb/vi
151069670 lrwxr-xr-x   1 tpersky   bin            8 Apr 22 14:23
        /afs/.alw.nih.gov/unix/rs_aix31/usr/ucb/vi -> ./bin/vi

The "tar" utility could not make a hard link under /afs which spanned
the directories, so it made a symbolic link to "./bin/vi".  Unfortunately,
this should have been make as "../bin/vi", or the parent directory of "ucb".
All the symbolic links which are made using the "-s" option seem to point
to the wrong place.  This is especially serious, considering "tar" returns
an error status of zero.  (It does put out a warning that it is changing
a hard link to a symbolic one, however.)

If anyone knows of an easier way of "tar"ring file systems into AFS, would
you please let me know?  We were hoping this version of "tar" would fit
the bill, but it does not.

Thanks,

        Ted Persky                      phone: (301) 402-1818
        Building 12A, Room 2031         uucp: uunet!nih-csl!tpersky

        Bethesda, MD 20892

--
        Ted Persky                      phone: (301) 402-1818
        Building 12A, Room 2031         uucp: uunet!nih-csl!tpersky

        Bethesda, MD 20892