Re: tar and --include

2010-05-19 Thread b. f.
On 5/20/10, Tim Kientzle  wrote:
> b. f. wrote:
>> Martin McCormick wrote:
>>>What I discovered was that --include doesn't appear to
>>> do anything at all. The example in the man page shows using it
>>> to filter an existing archive ...  I never
>>> tried that since that is not what was needed here.
>
> The --include directive was designed to support the
> case of filtering an existing archive.  GNU tar has
> no equivalent to bsdtar's @archive feature and hence
> has no real need for --include.
>

...

>
>> There certainly seems to be a bug here, either in the documentation or
>> the implementation.  The example you mention works as expected for me
>> on 9-CURRENT, but the --include option fails on, for example:
>>
>> tar -cvf new.tar --include='baz'  foo/bar
>
> In your example here, the first item
> tar inspects is "foo/bar", which does not match
> the pattern and therefore is not included.
> Excluding a directory excludes everything
> in the directory.
>
> The net result is the same as if you had specified:
> tar -cvf new.tar --exclude='foo/bar' foo/bar

tar(1) states "The --include option is especially useful when
filtering archives."  If I understand your comments correctly, this
statement should be changed to state that the option is, in fact,
_only_ useful when filtering archives. The current description of the
option is misleading.


b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: tar and --include

2010-05-19 Thread Tim Kientzle

b. f. wrote:

Martin McCormick wrote:

   What I discovered was that --include doesn't appear to
do anything at all. The example in the man page shows using it
to filter an existing archive ...  I never
tried that since that is not what was needed here.


The --include directive was designed to support the
case of filtering an existing archive.  GNU tar has
no equivalent to bsdtar's @archive feature and hence
has no real need for --include.

If you really need detailed control over which
files get archived, I do recommend learning how
to use find(1) in conjunction with tar.  (Just remember
to use tar's -n option!)


There certainly seems to be a bug here, either in the documentation or
the implementation.  The example you mention works as expected for me
on 9-CURRENT, but the --include option fails on, for example:

tar -cvf new.tar --include='baz'  foo/bar


In your example here, the first item
tar inspects is "foo/bar", which does not match
the pattern and therefore is not included.
Excluding a directory excludes everything
in the directory.

The net result is the same as if you had specified:
   tar -cvf new.tar --exclude='foo/bar' foo/bar

Cheers,

Tim

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: tar and --include

2010-05-19 Thread b. f.
Martin McCormick wrote:
>A few days ago, I asked about the --include directive in tar
>after things didn't quite work the way the man page seemed to
>indicate. One might get the impression that if --include or
>--include='*pattern*' was added to a tar command, tar would only
>archive what was in the pattern and not archive everything as
>its default operation.
>
>What I discovered was that --include doesn't appear to
>do anything at all. The example in the man page shows using it
>to filter an existing archive and make a tar file of what was in
>the existing archive that also matched the pattern. I never
>tried that since that is not what was needed here.

There certainly seems to be a bug here, either in the documentation or
the implementation.  The example you mention works as expected for me
on 9-CURRENT, but the --include option fails on, for example:

tar -cvf new.tar --include='baz'  foo/bar

when the pattern baz should match files in the directory foo/bar,
regardless of whether baz contains wildcards or not, or when baz is
anchored at the start or not.  The output is garbage.

>

...

>The --include directive only seems to exist in the
>FreeBSD form of tar. I tried a Linux system's tar man page and
>it is not there but both support the -X path/filename for a list
>of exclusion patterns.
>

I don't see your point here.  For the sake of compatibility, bsdtar
aims to support GNU tar features, but not _only_ those features. The
--include option is useful for specifying files and directories to
include without having to anchor inclusion patterns from the start,
and without having to use tar -I/-T with an inclusion file, or tar in
conjunction with find(1) -- so the option should be fixed so that it
works.

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


tar and --include

2010-05-19 Thread Martin McCormick
A few days ago, I asked about the --include directive in tar
after things didn't quite work the way the man page seemed to
indicate. One might get the impression that if --include or
--include='*pattern*' was added to a tar command, tar would only
archive what was in the pattern and not archive everything as
its default operation.

What I discovered was that --include doesn't appear to
do anything at all. The example in the man page shows using it
to filter an existing archive and make a tar file of what was in
the existing archive that also matched the pattern. I never
tried that since that is not what was needed here.

What turned out to work very well was to use the feature
in tar that lets one exclude a whole list of patterns in a
designated file. You just put in what shouldn't be in the
archive and it appeared to work fine.

The --include directive only seems to exist in the
FreeBSD form of tar. I tried a Linux system's tar man page and
it is not there but both support the -X path/filename for a list
of exclusion patterns.

Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Telecommunications Services Group
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"