From owner-freebsd-questions@FreeBSD.ORG Thu May 20 02:26:39 2010 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 989D0106566C; Thu, 20 May 2010 02:26:39 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-ww0-f54.google.com (mail-ww0-f54.google.com [74.125.82.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0B5FF8FC17; Thu, 20 May 2010 02:26:38 +0000 (UTC) Received: by wwb39 with SMTP id 39so1262769wwb.13 for ; Wed, 19 May 2010 19:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to:date :message-id:subject:from:to:cc:content-type; bh=lOfYS9CFVO9VlEYs1Z3A9phEMcrg437BmbP/c0f6FCY=; b=ZfeiriGhpa4++xlsBr31wazsr9G5qlIax38OqQyZ3R7si7QGXIZ2hJhP5yRs0atYId A9grYJluVVXjwy6na1XGPEEmUeCX15nPCt/bULyq6F+aBEUYtM9RKI3W8Uk/XprUff75 h26JrQnNcxWiaIFl2kV4FShYYLw+Sn9vQlCfg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; b=AY+cQPSMXsVyJvw8CMAiTdBl582gMNfmV3WApL598ZUlAVsjaYgchPQwrjL0iYpw/n 11CiVZEkyjRVM0lFfcHR31LLxg7QxfdbH9A/91Fe5sX3Db8oQ8JqNyWZyF3XzGuEibat 9B9ja8TPPsjDEfdd/C0y9mE5VRZluzxTr9GGk= MIME-Version: 1.0 Received: by 10.216.172.71 with SMTP id s49mr1590967wel.195.1274322398043; Wed, 19 May 2010 19:26:38 -0700 (PDT) Received: by 10.216.64.68 with HTTP; Wed, 19 May 2010 19:26:37 -0700 (PDT) Date: Thu, 20 May 2010 02:26:37 +0000 Message-ID: From: "b. f." To: freebsd-questions@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Martin McCormick , kientzle@FreeBSD.org Subject: Re: tar and --include X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bf1783@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2010 02:26:39 -0000 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.