diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-04-11 13:45:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-04-11 13:45:32 +0300 |
commit | d70b8b3b3978df2ba204f3afe60b18ded6164b07 (patch) | |
tree | 04d4180b9a53a9b67801d5b60c7138ed887cfe83 /tests/extrac22.at | |
parent | c445d99d4f8aae6932a5385b8fbfb77a77acbff5 (diff) | |
download | tar-d70b8b3b3978df2ba204f3afe60b18ded6164b07.tar.gz |
Fix --delay-directory-restore on archives with reversed member ordering.
* src/extract.c (find_direct_ancestor): Remove useless test.
(delay_set_stat): If the file name being added is already in
the list, update stored data instead of creating a new entry.
This works for archives with reversed order of members.
* tests/extrac22.at: New testcase.
* tests/Makefile.am: Add new testcase.
* tests/testsuite.at: Include new testcase.
Diffstat (limited to 'tests/extrac22.at')
-rw-r--r-- | tests/extrac22.at | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/extrac22.at b/tests/extrac22.at new file mode 100644 index 00000000..449d4df6 --- /dev/null +++ b/tests/extrac22.at @@ -0,0 +1,60 @@ +# Test suite for GNU tar. -*- Autotest -*- +# Copyright 2017-2019 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 <http://www.gnu.org/licenses/>. + +AT_SETUP([delay-directory-restore on reversed ordering]) + +# The --delay-directory-resore option worked incorrectly on archives with +# reversed member ordering (which was documented, anyway). This is illustrated +# in +# http://lists.gnu.org/archive/html/bug-tar/2019-03/msg00022.html +# which was taken as a base for this testcase. +# The bug affected tar versions <= 1.32. + +AT_KEYWORDS([extract extrac22 delay delay-reversed]) +AT_TAR_CHECK([ +AT_UNPRIVILEGED_PREREQ +AT_SORT_PREREQ +mkdir t +(cd t + genfile --length 100 --file data1 + mkdir dir1 + cp data1 dir1 + mkdir dir2 + cd dir2 + ln -s ../dir1/data1 data2 + cd .. + chmod -w dir2) + +AT_DATA([filelist], +[./dir2/data2 +./dir2 +./dir1/data1 +./dir1 +./data1 +]) + +tar -C t -c -f a.tar --no-recursion -T filelist + +mkdir restore +tar -x -p --delay-directory-restore -C restore -f a.tar +# Previous versions of tar would fail here with the following diagnostics: +# tar: ./dir2/data2: Cannot unlink: Permission denied +], +[0], +[]) +AT_CLEANUP
\ No newline at end of file |