-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Restic fails to create the mount point directory if the parent directory does not exist #1681
Description
Output of restic version
restic 0.8.3 compiled with go1.10 on darwin/amd64
How did you run restic exactly?
sudo restic -r /Volumes/ex mount /mnt/bak
Since this is a Mac /mnt does not exist yet.
What backend/server/service did you use to store the repository?
Local
Expected behavior
If the mount point is not accessible to restic, one of:
- Restic would not try to create any directory and just fail if the mount point does not exist
- Restic would try and create the mount point and all parent directories
Actual behavior
Restic wants to be nice and tries to create the mount point for you, if it notices that it's missing.
However restic does not check if the parent directory of the mount point exists. This leads to a situation where restic tries to create the mount point, but the operation fails due to the parent directory not existing.
Steps to reproduce the behavior
# restic -r /tmp/test init
# restic -r /tmp/test mount $HOME/path/to/your/very/deep/mount/directory/thats/without/a/parent
enter password for repository:
password is correct
Mountpoint /Users/nobody/path/to/your/very/deep/mount/directory/thats/without/a/parent doesn't exist, creating it
mkdir /Users/nobody/path/to/your/very/deep/mount/directory/thats/without/a/parent: no such file or directory
unable to umount (maybe already umounted?): unmount /Users/nobody/path/to/your/very/deep/mount/directory/thats/without/a/parent: no such file or directory
Do you have any idea what may have caused this?
Do you have an idea how to solve the issue?
In this case I don't think restic has to be extra nice to the end user. The program should just fail if the mount point does not exist.
However if restic wants to be nice to the end user, we would need to add MkDirAll to the FS functions and use that to create the mount point.