tar and dir attribs

From: T. Horsnell \(tsh\) (tsh@mrc-lmb.cam.ac.uk)
Date: Thu Jan 22 2004 - 11:42:08 EST


Hi all,

ES45, TU64 V5.1B PK2

I'm seeing some very odd behaviour with tar.
If I tar up a directory which has protection 1777
(rwxrwxrwxt) and then untar it into a different
place, the new directory only has protection 755.
If I repeat the operation with the new directory
already in place, its protection changes to 1777
I'm doing this logged in as (not su'd to) root.

Have I missed some subtle comment in the man pages,
or is something amis with tar? The procedure
works correctly with Gnu-tar.

The following script will demonstrate the problem:
Can anyone with the same OS version and patch level
confirm/deny what I'm seeing?

Thanks,
Terry.

#!/bin/csh
#
#####Run me as root in a scratch directory:
#make a source directory
mkdir tmp1
#
#make a test dir in that source dir with protection 1777
mkdir tmp1/test
chmod 1777 tmp1/test
#
#make a dest directory into which to untar the test dir
mkdir tmp2
#
#tar up the (empty) test dir and untar it into the source dir
tar cf - -C tmp1 . | (cd tmp2; tar xpf -)
#
#list the source and dest dirs
#note the wrong protection on /tmp2/test
ls -l tmp1
ls -l tmp2
#
#leave the test dir in place and repeat the operation.
#note the different (correct) protection on tmp2/dest
tar cf - -C tmp1 . | (cd tmp2; tar xpf -)
ls -l tmp1
ls -l tmp2
#
#remove the test dir
rmdir tmp2/test



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:49 EDT