tar and --include

b. f. bf1783 at googlemail.com
Thu May 20 06:06:50 UTC 2010


On 5/20/10, Tim Kientzle <kientzle at freebsd.org> 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.


More information about the freebsd-questions mailing list