Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 May 2010 02:26:37 +0000
From:      "b. f." <bf1783@googlemail.com>
To:        freebsd-questions@FreeBSD.org
Cc:        Martin McCormick <martin@dc.cis.okstate.edu>, kientzle@FreeBSD.org
Subject:   Re: tar and --include
Message-ID:  <AANLkTilrvL7wDdpGdyT1YZjrai_f2Se024tBGWr0Bcn7@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTilrvL7wDdpGdyT1YZjrai_f2Se024tBGWr0Bcn7>