From 41654f91f08eeff204d2ec2dabf2b81530060aaa Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 15 Feb 2020 10:57:35 +0200 Subject: Fix handling of linked rename chains in incremental backups * src/incremen.c: Change the meaning of the DIRF_RENAMED flag. Now it marks a directory which is the last one in a chain of renames. Regular renamed directories are recognized by their orig member being non-NULL. Directories marked with DIRF_RENAMED start encoding of renames. (procdir): Clear DIRF_RENAMED flag on directories which are origins for renames. (makedumpdir): Use the orig member to check if the directory is a result of a rename. (store_rename): Move the check for DIR_IS_RENAMED to the caller. Don't clear the DIRF_RENAMED, it is not needed any more. * tests/rename06.at: New test. * tests/Makefile.am: Add rename06.at * tests/testsuite.at: Likewise. --- tests/rename06.at | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 tests/rename06.at (limited to 'tests/rename06.at') diff --git a/tests/rename06.at b/tests/rename06.at new file mode 100644 index 00000000..d1db9200 --- /dev/null +++ b/tests/rename06.at @@ -0,0 +1,88 @@ +# Test suite for GNU tar. +# Copyright 2020 Free Software Foundation, Inc. +# +# This file is part of GNU tar. +# +# GNU tar is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# GNU tar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +AT_SETUP([chained renames]) +AT_KEYWORDS([incremental rename06 rename]) + +# Description: test whether chained renames are processed correctly +# during the incremental archive creation. Tar 1.32.90 failed to +# encode them. +# Reported by: Deweloper +# References: <20200214100922.44c43334@amazur-u.kat.adbgroup.pl>, +# https://lists.gnu.org/archive/html/bug-tar/2020-02/msg00008.html + +AT_TAR_CHECK([ +AT_SORT_PREREQ +decho Creating directory structure +mkdir test test/d1 test/d2 +genfile --file test/d1/file1 +genfile --file test/d2/file2 + +decho First dump +tar -c -g 0.snar -C test -f backup0.tar . + +decho Altering directory structure +genfile --file test/d2/file3 +mv test/d1 test/d3 +mv test/d2 test/d1 + +decho Second dump +cp 0.snar 1.snar +tar -vc -g 1.snar -C test -f backup1.tar . + +mkdir test1 + +decho First extract +tar -C test1 -x -g /dev/null -f backup0.tar + +decho Second extract +tar -C test1 -x -g /dev/null -f backup1.tar + +decho Resulting directory +find test1 | sort +], +[0], +[Creating directory structure +First dump +Altering directory structure +Second dump +./ +./d1/ +./d3/ +./d1/file3 +First extract +Second extract +Resulting directory +test1 +test1/d1 +test1/d1/file2 +test1/d1/file3 +test1/d3 +test1/d3/file1 +], +[Creating directory structure +First dump +Altering directory structure +Second dump +tar: ./d1: Directory has been renamed from './d2' +tar: ./d3: Directory has been renamed from './d1' +First extract +Second extract +Resulting directory +],[],[],[gnu, oldgnu, posix]) +AT_CLEANUP \ No newline at end of file -- cgit v1.2.1