Tk Library Source Code

View Ticket
Login
Ticket UUID: 1655119
Title: Possible permissions problem with tar
Type: Bug Version: None
Submitter: imkepper Created on: 2007-02-08 12:21:32
Subsystem: tar Assigned To: afaupell
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2007-02-13 02:46:45
Resolution: Fixed Closed By: afaupell
    Closed on: 2007-02-12 19:46:45
Description:
(Some of this was posted to comp.lang.tcl):

I have a simple script that uses the tcllib tar command.  It tar creates a tar file containing a directory.  The directory contains subdirectories.  Each of those sub-directories contain the following
sub-directories:

exec/
export/
server/
lib/

The directory tree looks this way:

devdir_4.1/
        subdir1/
                   exec/
                            bin/
                                file1
                                file2
                                file3

                   export/
                                file1
                                file2
                                file3

                   lib/
                                file1
                                file2
                                file3

                   server/
                            bin/
                                file1

        subdir2/
                   exec/
                            bin/
                                file1
                                file2
                                file3
                   export/
                                file1
                                file2
                                file3

                   lib/
                                file1
                                file2
                                file3

                   server/
                            bin/
                                file1

...  etc

The problem I am having is that it is not archiving the exec/ directory.   The export/ directory does contain some of the same executables that are located in the exec/ directory.  But, when you do a tar tvf on the tarfile that is created, there is one instance of the
exec directory in one of the subdirs, but none of the others.  It's as if the exec/ directory gets passed over.

Here is my script:

#!/usr/bin/tclsh

lappend auto_path /export/kdp/dev/tcl/lib
package require tar

::tar::create tarball.tar devdir_4.1 

I got an e-mail respnse from an Aaron F. requesting a tarball so he could look at the problem.  Because of company proprietary issues, I could not send the originals.  So, I dummied up a set of files in a tarball.  I created a directory structure that contained files from /bin and /lib (on my linux box) to simulate the kind of files each directory contained.  When I ran the script against the new tarball, it worked just fine.  So, apparently, there is  something else weird going on.    I'm thinking now it may be some sort of permissions problem.  Other notes of interest:

- I am grabbing files from across a local network via NFS.
- None of the files are symbolically linked.
- The directory that I am tarring from was populated by various operating systems (Solaris, HP-UX, Linux, AIX).

Thanks for your great work.  
Have a nice day,
Keith Pickett
User Comments: afaupell added on 2007-02-13 02:46:45:
Logged In: YES 
user_id=812825
Originator: NO

submitter has confirmed previously commited changes have fixed the issue.

lvirden added on 2007-02-13 02:34:24:
Logged In: YES 
user_id=15949
Originator: NO

Using the latest tcllib, today, Feb 12th, the discrepancies that I saw between files included has been resolved.

andreas_kupries added on 2007-02-13 01:43:34:
Logged In: YES 
user_id=75003
Originator: NO

This seems to have been fixed by Aaron on Feb 8 if I read the ChangeLog right. Can we please get feedback that that fix is working for the submitter ?

andreas_kupries added on 2007-02-09 01:12:32:
Logged In: YES 
user_id=75003
Originator: NO

Would it make sense to use 'fileutil::find' instead of re-implementing directory traversal in 'tar' ?
The skipping of links (-dereference 0) can be implement via the 'filter command' callback of 'find'.

lvirden added on 2007-02-08 20:09:19:
Logged In: YES 
user_id=15949
Originator: NO

hmm - guess not - stupid web app won't let me upload here!

Here's the text of the script:
#! /bin/ksh

mkdir /tmp/tartest
cd /tmp/tartest
cat >tartest.tcl <<EOF
#!/projects/sprs_lwv/tcl85/bin/tclsh
package require tar
::tar::create tarball.tar devdir_4.1
EOF

chmod 755 tartest.tcl

mkdir -p devdir_4.1/subdir1 devdir_4.1/subdir2
for j in subdir1 subdir2 ; do
  cd /tmp/tartest/devdir_4.1/$j
  mkdir -p exec/bin export server/bin lib
  for i in exec/bin export server/bin lib ; do
        touch $i/file1 $i/file2 $i/file3
  done
done

cd /tmp/tartest
ls -lR /tmp/tartest/devdir_4.1 > ls.output

/tmp/tartest/tartest.tcl
ls -l tarball.tar
gtar tf tarball.tar | sort > tar.tcl.output

and here's what I see in terms of output:

cat ls.output

/tmp/tartest/devdir_4.1:
total 32
drwxr-xr-x   6 lwv27    dept27       364 Feb  8 08:04 subdir1
drwxr-xr-x   6 lwv27    dept27       364 Feb  8 08:04 subdir2

/tmp/tartest/devdir_4.1/subdir1:
total 64
drwxr-xr-x   3 lwv27    dept27       177 Feb  8 08:04 exec
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 export
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 lib
drwxr-xr-x   3 lwv27    dept27       177 Feb  8 08:04 server

/tmp/tartest/devdir_4.1/subdir1/exec:
total 16
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 bin

/tmp/tartest/devdir_4.1/subdir1/exec/bin:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir1/export:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir1/lib:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir1/server:
total 16
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 bin

/tmp/tartest/devdir_4.1/subdir1/server/bin:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir2:
total 64
drwxr-xr-x   3 lwv27    dept27       177 Feb  8 08:04 exec
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 export
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 lib
drwxr-xr-x   3 lwv27    dept27       177 Feb  8 08:04 server

/tmp/tartest/devdir_4.1/subdir2/exec:
total 16
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 bin

/tmp/tartest/devdir_4.1/subdir2/exec/bin:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir2/export:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir2/lib:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

/tmp/tartest/devdir_4.1/subdir2/server:
total 16
drwxr-xr-x   2 lwv27    dept27       303 Feb  8 08:04 bin

/tmp/tartest/devdir_4.1/subdir2/server/bin:
total 0
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file1
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file2
-rw-r--r--   1 lwv27    dept27         0 Feb  8 08:04 file3

and here's the output from the tar file:

devdir_4.1/subdir1/exec/bin/file1
devdir_4.1/subdir1/exec/bin/file3
devdir_4.1/subdir1/export
devdir_4.1/subdir1/export/file3
devdir_4.1/subdir1/lib
devdir_4.1/subdir1/lib/file1
devdir_4.1/subdir1/lib/file2
devdir_4.1/subdir1/lib/file3
devdir_4.1/subdir1/server
devdir_4.1/subdir1/server/bin/file1
devdir_4.1/subdir1/server/bin/file3
devdir_4.1/subdir2
devdir_4.1/subdir2/exec/bin/file1
devdir_4.1/subdir2/exec/bin/file3
devdir_4.1/subdir2/export
devdir_4.1/subdir2/export/file1
devdir_4.1/subdir2/export/file3
devdir_4.1/subdir2/lib
devdir_4.1/subdir2/lib/file1
devdir_4.1/subdir2/lib/file2
devdir_4.1/subdir2/lib/file3
devdir_4.1/subdir2/server
devdir_4.1/subdir2/server/bin/file1
devdir_4.1/subdir2/server/bin/file3

Notice that file2 is missing in nearly every directory in which it resides. Also note that file1 is missing from export directory.

lvirden added on 2007-02-08 20:06:10:
Logged In: YES 
user_id=15949
Originator: NO

I have a case where my filesystem is local, there are no symlinks, and I also get invalid results. I am uploading a ksh that creates a directory subtree that models the above description, then runs the tcl script (in my environment, it uses the latest tcllib and tcl). The resulting tar file will also be uploaded.