bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tar-1.12 through tar-1.13.25: dir/file name conflict on restore with --l


From: John E Hein
Subject: tar-1.12 through tar-1.13.25: dir/file name conflict on restore with --listed-incremental
Date: Wed, 12 Dec 2001 09:52:43 -0700

Before I try to come up with a patch, I am soliciting your opinion
 as to whether this is a bug or not.  Do you agree that the following
 behavior (extracted from the info pages, Node: Dealing with Old Files)
 is inappropriate when using --listed-incremental?  I am referring
 specifically to the behavior when an existing non-empty directory
 conflicts with a file in an "incremental" archive.

Here's the excerpt from the info page:

   When extracting files, if `tar' discovers that the extracted file
already exists, it normally replaces the file by removing it before
extracting it, to prevent confusion in the presence of hard or symbolic
links.  (If the existing file is a symbolic link, it is removed, not
followed.)  However, if a directory cannot be removed because it is
nonempty, `tar' neither removes it nor modifies its ownership,
permissions, or time stamps.


Here's an example demonstrating the issue when trying to extract over a
 non-empty dir when using --listed-incremental:

% cat doit
tar --version
mkdir test
cd test
mkdir foo
mkdir foo/bar
touch foo/bar/junk
touch foo/baz
tar --listed-incremental full.list -cf full.tar -v foo
rm -rf foo/bar
touch foo/bar
tar --listed-incremental incr.list -cf incr.tar -v foo
mkdir restore
cd restore
tar --listed-incremental ../full.list -xf ../full.tar -v
tar --listed-incremental ../full.list -xf ../incr.tar -v
echo "exit status: $?"


% sh -x doit
+ tar --version
tar (GNU tar) 1.13.25
Copyright (C) 2001 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by John Gilmore and Jay Fenlason.
+ rm -rf test
+ mkdir test
+ cd test
+ mkdir foo
+ mkdir foo/bar
+ touch foo/bar/junk
+ touch foo/baz
+ tar --listed-incremental full.list -cf full.tar -v foo
tar: foo/bar: Directory is new
foo/
foo/bar/
foo/baz
foo/bar/junk
+ rm -rf foo/bar
+ touch foo/bar
+ tar --listed-incremental incr.list -cf incr.tar -v foo
foo/
foo/bar
foo/baz
+ mkdir restore
+ cd restore
+ tar --listed-incremental ../full.list -xf ../full.tar -v
foo/
foo/bar/
foo/baz
foo/bar/junk
+ tar --listed-incremental ../full.list -xf ../incr.tar -v
foo/
foo/bar
tar: foo/bar: Cannot open: File exists
foo/baz
tar: Error exit delayed from previous errors
+ echo exit status: 2
exit status: 2


Note that this behavior persists even when specifying
 --overwrite &/or --overwrite-dir.

When using a set of archives to restore a file system, this could be
 an issue.  Example:

- full backup of filesystem X
- incremental #1 backup of filesystem X
- remove some non-empty dir on filesystem X
- create a file of the same name
- incremental #2 backup of filesystem X
- disk crash
- restore attempt:
   - extract full backup
   - extract incremental #1
   - extract incremental #2 (error occurs here)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]