From owner-freebsd-bugs@FreeBSD.ORG Thu Sep 23 22:20:04 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46EE81065670 for ; Thu, 23 Sep 2010 22:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 095EE8FC08 for ; Thu, 23 Sep 2010 22:20:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o8NMK35n011652 for ; Thu, 23 Sep 2010 22:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o8NMK382011651; Thu, 23 Sep 2010 22:20:03 GMT (envelope-from gnats) Resent-Date: Thu, 23 Sep 2010 22:20:03 GMT Resent-Message-Id: <201009232220.o8NMK382011651@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tobias Herre Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED0FC1065673 for ; Thu, 23 Sep 2010 22:17:44 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id C10EA8FC12 for ; Thu, 23 Sep 2010 22:17:44 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NMHi9W018894 for ; Thu, 23 Sep 2010 22:17:44 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o8NMHiKa018893; Thu, 23 Sep 2010 22:17:44 GMT (envelope-from nobody) Message-Id: <201009232217.o8NMHiKa018893@www.freebsd.org> Date: Thu, 23 Sep 2010 22:17:44 GMT From: Tobias Herre To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/150890: bsdtar does not always dive into subdirectories with --newerXXX option X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 22:20:04 -0000 >Number: 150890 >Category: misc >Synopsis: bsdtar does not always dive into subdirectories with --newerXXX option >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 23 22:20:03 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Tobias Herre >Release: FreeBSD 8.1 >Organization: SRH Hochschule Berlin >Environment: grusel 8.1-STABLE FreeBSD 8.1-STABLE #1: Thu Sep 16 13:40:46 UTC 2010 root@grusel2.otauni.de:/usr/obj/usr/src/sys/SRHPOWER amd64 >Description: when --newerXXX option is given bsdtar ignores directory subtrees where modified or new files could exist if the parent directory is not modified. >How-To-Repeat: grusel# mkdir -p test/txt grusel# echo "Hello" > test/txt/hello.txt grusel# tar -v -c -f archive0.tar test a test a test/txt a test/txt/hello.txt grusel# echo "World" >> test/txt/hello.txt grusel# tar -v -c -f archive1.tar --newer-than archive0.tar test grusel# tar -t -f archive0.tar test/ test/txt/ test/txt/hello.txt grusel# tar -t -f archive1.tar grusel# >Fix: Apply the patch Patch attached with submission follows: --- usr.bin/tar/write.orig 2010-09-23 22:03:20.838021523 +0200 +++ usr.bin/tar/write.c 2010-09-23 22:54:58.985341640 +0200 @@ -752,13 +752,6 @@ descend = 0; } - /* - * In -u mode, check that the file is newer than what's - * already in the archive; in all modes, obey --newerXXX flags. - */ - if (!new_enough(bsdtar, name, st)) - continue; - archive_entry_free(entry); entry = archive_entry_new(); @@ -813,7 +806,7 @@ * check would veto this file, we shouldn't bother * the user with it. */ - if (bsdtar->option_interactive && + if (bsdtar->option_interactive && new_enough(bsdtar, name, st) && !yes("add '%s'", name)) continue; @@ -821,6 +814,15 @@ if (descend && !bsdtar->option_no_subdirs) tree_descend(tree); + + /* + * In -u mode, check that the file is newer than what's + * already in the archive; in all modes, obey --newerXXX flags. + */ + if (!new_enough(bsdtar, name, st)) + continue; + + /* * Rewrite the pathname to be archived. If rewrite * fails, skip the entry. >Release-Note: >Audit-Trail: >Unformatted: