mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Avoid miserably failing when attempting to create link in some edge case
This commit is contained in:
parent
a974d08897
commit
ea98cf557e
1 changed files with 12 additions and 3 deletions
|
@ -1633,9 +1633,18 @@ class BackupMethod(object):
|
||||||
# 'NUMBER OF HARD LINKS > 1' see #1043
|
# 'NUMBER OF HARD LINKS > 1' see #1043
|
||||||
cron_path = os.path.abspath('/etc/cron') + '.'
|
cron_path = os.path.abspath('/etc/cron') + '.'
|
||||||
if not os.path.abspath(src).startswith(cron_path):
|
if not os.path.abspath(src).startswith(cron_path):
|
||||||
os.link(src, dest)
|
try:
|
||||||
# Success, go to next file to organize
|
os.link(src, dest)
|
||||||
continue
|
except Exception as e:
|
||||||
|
# This kind of situation may happen when src and dest are on different
|
||||||
|
# logical volume ... even though the st_dev check previously match...
|
||||||
|
# E.g. this happens when running an encrypted hard drive
|
||||||
|
# where everything is mapped to /dev/mapper/some-stuff
|
||||||
|
# yet there are different devices behind it or idk ...
|
||||||
|
logger.warning("Could not link %s to %s (%s) ... falling back to regular copy." % (src, dest, str(e)))
|
||||||
|
else:
|
||||||
|
# Success, go to next file to organize
|
||||||
|
continue
|
||||||
|
|
||||||
# If mountbind or hardlink couldnt be created,
|
# If mountbind or hardlink couldnt be created,
|
||||||
# prepare a list of files that need to be copied
|
# prepare a list of files that need to be copied
|
||||||
|
|
Loading…
Add table
Reference in a new issue