-
-
Notifications
You must be signed in to change notification settings - Fork 827
Closed
Description
If you accidentally specify a path to be backed up twice and this path contain hardlinks, you cannot succesfully extract these files
Eg:
mkdir /tmp/borgtest /tmp/borgrepo /tmp/borgtest/a /tmp/borgtest/b /tmp/extractlocation
borg init -e none /tmp/borgrepo
echo "Hi Everybody" > /tmp/borgtest/a/hardlink
ln /tmp/borgtest/a/hardlink /tmp/borgtest/b/hardlink
borg create /tmp/borgrepo::testarchive /tmp/borgtest/ /tmp/borgtest/
borg list /tmp/borgrepo::testarchive
cd /tmp/extractlocation
borg extract /tmp/borgrepo::testarchive
returns
tmp/borgtest/a/hardlink: link: [Errno 2] No such file or directory: '/private/tmp/extractlocation/tmp/borgtest/a/hardlink' -> '/private/tmp/extractlocation/tmp/borgtest/a/hardlink'
tmp/borgtest/b/hardlink: link: [Errno 2] No such file or directory: '/private/tmp/extractlocation/tmp/borgtest/a/hardlink' -> '/private/tmp/extractlocation/tmp/borgtest/b/hardlink'
and both the hardlink and the file it was pointing to will be gone
When I list the archive I can see the file and the hardlink are both there
borg list /tmp/borgrepo::testarchive
drwxr-xr-x arnold wheel 0 Wed, 2020-12-30 10:27:21 tmp/borgtest
drwxr-xr-x arnold wheel 0 Wed, 2020-12-30 10:27:24 tmp/borgtest/a
-rw-r--r-- arnold wheel 13 Wed, 2020-12-30 10:27:45 tmp/borgtest/a/hardlink
drwxr-xr-x arnold wheel 0 Wed, 2020-12-30 10:27:28 tmp/borgtest/b
hrw-r--r-- arnold wheel 0 Wed, 2020-12-30 10:27:45 tmp/borgtest/b/hardlink link to tmp/borgtest/a/hardlink
drwxr-xr-x arnold wheel 0 Wed, 2020-12-30 10:27:21 tmp/borgtest
drwxr-xr-x arnold wheel 0 Wed, 2020-12-30 10:27:24 tmp/borgtest/a
hrw-r--r-- arnold wheel 0 Wed, 2020-12-30 10:27:45 tmp/borgtest/a/hardlink link to tmp/borgtest/a/hardlink
drwxr-xr-x arnold wheel 0 Wed, 2020-12-30 10:27:28 tmp/borgtest/b
hrw-r--r-- arnold wheel 0 Wed, 2020-12-30 10:27:45 tmp/borgtest/b/hardlink link to tmp/borgtest/a/hardlink
So I assume I could probably still rescue the file somehow if i wanted, and that the file is actually written to disk during restore and then removed.
Now of course, one shouldn't do this in the first place - but shouldn't borg have realised it's creating a hardlink to itself (.. a/hardlink to ../a/hardlink) and ignore/bail out on that point ? Or ignore/fail duplicate pathnames on the command line?
Reactions are currently unavailable