feat: prevent backing up to a target dir that is nested in a source dir
ca-scribner opened this issue · comments
(after writing noticed this is a duplicate of #1626, although my guess at the cause was different than theirs. I had shut things down before seeing the post so couldn't go and check which assumptions were right)
On first use I didn't realise mackup would backup the ~/.mackup
dir, so I put my storage
path=.mackup/backup
. mackup got into an infinite recursion and eventually broke, but had already replaced many files with symlinks to that partial backup.
The problem got worse for me as I didn't realise the consequences until too late. It seemed clear that I shouldn't nest the backup target in the .mackup
dir so I deleted the backup and tried again elsewhere, not realising that the files that some of the files from the backup had been replaced with symlinks to the partial backup I was deleting. I am not sure if recovery from that state would have been easy.
Ideally, it would be nice to prevent this mistake. At a minimum, catching a recursion failure and giving a strong and direct warning about how to recover would be good.