[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

--directory option etc in GNU tar (1.12)

From: Kim Lester
Subject: --directory option etc in GNU tar (1.12)
Date: Fri, 11 Oct 2002 01:06:04 +1000

        The -C (--directory) option is only defined (apparently) for creation
        (and it requires a filename after it)

        I'm not sure of the elegant way to force tar to extract
        TO a specific dir root/base.

        Of course I can type:  cd /frodo; tar -xvf tarfile
        but this requires me to provide an absolute path to tarfile.

        It seems reasonable at first glance to want:

                tar -xvf tarfile --directory=/frodo

        and have tar chdir() just before it starts work.

        This has benefits when calling tar from scripts etc as it
        doesn't chantge the current dir and makes locating the tarfile

        Would appreciate feedback if you have time.
        It's late so I may be missing something blindingly obvious.

        Also whilst I think of it some constructive feedback

        1) I think gnu tar requires a few too many options to get a perfect
                copy incluiding times, perms etc. And I forget if it handles all
                times well (c,m and a).
                IMHO the following options could be made available
                        in a single letter option (yeah I know horrible but
                         --same-owner --atime-preserve
                         --preserve-permission --preserve-order

                (--preserve seems to go half way)

                cpio -dump ... makes a near perfect copy.

        2) I would like to create (gzipped) tar archives from a program.
                Perhaps I'm weird but I want to use .tgz as an interchange 
                for a packaging system I have. At the simplest level I could
                creat the files individually on disk but I need to be able to
                specify their uid/gid/perms/location explicitly via API since
                they would be untarred in a different directory structure
                to the one they are packed from.
                This may sound silly but when you realise it is a package
                installation program it makes sense.
                If any has the time to let me know if this is likely
                to be easy using libtar.a or "horrendously difficult because
                tar funcs just don't work that way" I'd appreciate it.

        3) The docs may be unclear on what happens to dir perms 
                if untarring and the dir already exists. Does tar only
                set dir perms if it has to create the dir?
                ie if the directory exists does tar apply perms from the tar

        4) I think --recursive-unlink is probably evil and should
                be removed on the principle that it affects files
                which have nothing to do with the tar archive.
                Presumably if one wants a clean untar one can do
                an 'rm -fr' and one then is aware of the action.


   p.s.  Happy to consider making any suggested changes myself if I
                get the chance after your feedback. No promises though
                free time is a rare beast.

Kim Lester,
Senior Engineer,
Datafusion and Visualisation Systems


reply via email to

[Prev in Thread] Current Thread [Next in Thread]