Date: Thu, 23 Sep 2010 22:17:44 GMT From: Tobias Herre <tobias.herre@srh-hochschule-berlin.de> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/150890: bsdtar does not always dive into subdirectories with --newerXXX option Message-ID: <201009232217.o8NMHiKa018893@www.freebsd.org> Resent-Message-ID: <201009232220.o8NMK382011651@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009232217.o8NMHiKa018893>