Hi all,
I have quite interesting observation which perhaps is a manifest of a bug.
My use case is to:
- take a backup of a folder, having a set of files from this folder added to
--exclude-from file. I'm working with incremental backup (-g option set)
- on a new machine, restoring the tar to same location as on the original
machine. Note, the new machine has already some files in the location; if
anything exist, I want to replace / overwrite it.
Steps to reproduce:
1. Create files and folders structure as below:
/tmp/src
└── etc
├── A.cfg
└── config
├── 1.cfg
├── 2.cfg
└── 3.cfg
2. Create exclude and include files
mbp:tarTests jhartman$ cat /tmp/include.cfg
/tmp/src/etc/
mbp:tarTests jhartman$ cat /tmp/exclude.cfg
/tmp/src/etc/config/*.cfg
3. Create archive
rm -f /tmp/snapshot
$TAR_BASE/src/tar -g /tmp/snapshot -cvz -f /tmp/test.tar.gz -X /tmp/exclude.cfg
-T /tmp/include.cfg
./tar-1.27/src/tar: /tmp/src/etc: Directory is new
./tar-1.27/src/tar: /tmp/src/etc/config: Directory is new
./tar-1.27/src/tar: Removing leading `/' from member names
/tmp/src/etc/
/tmp/src/etc/config/
/tmp/src/etc/A.cfg
3. Un-archive to a new server. Before unarchiving, files in the new server:
/tmp/src
└── etc
├── A.cfg
└── config
├── 3.cfg
├── 4.cfg
└── 5.cfg
- un-archive (on the target machine)
$TAR_BASE/src/tar --overwrite --extract --force-local
--listed-incremental=/dev/null --file /tmp/test.tar.gz -v -C /
tmp/src/etc/
tmp/src/etc/config/
./tar-1.30/src/tar: Deleting ‘tmp/src/etc/config/4.cfg’
./tar-1.30/src/tar: Deleting ‘tmp/src/etc/config/5.cfg’
tmp/src/etc/A.cfg
So eventually, files in this folder:
/tmp/src
└── etc
├── A.cfg
└── config
└── 3.cfg
As you see, despite 4.cfg and 5.cfg was not int he src machine, they are gone.
I'm guessing it's because of using /tmp/src/etc/config/*.cfg in the exclude
file.
Worth to mention that this behaviour was changing across the versions: 1.30,
1.27, 1.27.1, 1.29 - NOK, 1.25, 1.26, 1.28 - OK (where NOK means - I could see
Deleting message for the files in my concern).
What do you think?
Thank you,
Jarek