diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2020-12-06 21:04:44 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2020-12-06 21:08:46 +0300 |
commit | a39a24beaec889a7a3a2e786dfef614056c47259 (patch) | |
tree | 38a428a5c7ba5686b8454307309a78d9426b2cb3 /Duplicati/Library | |
parent | 7d958adb8a71b334834ce42ecc9571c78e8a259e (diff) |
Catch and log exceptions encountered when getting symlink target.
Since the GetSymlinkTarget method can throw an exception, we should log
the failure case and avoid further processing of the symlink target.
This concerns #2171, which describes issues with symlinks created using
Windows Subsystem for Linux.
Diffstat (limited to 'Duplicati/Library')
-rw-r--r-- | Duplicati/Library/Main/Operation/Backup/MetadataPreProcess.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Duplicati/Library/Main/Operation/Backup/MetadataPreProcess.cs b/Duplicati/Library/Main/Operation/Backup/MetadataPreProcess.cs index bc72b7be7..a9e598d07 100644 --- a/Duplicati/Library/Main/Operation/Backup/MetadataPreProcess.cs +++ b/Duplicati/Library/Main/Operation/Backup/MetadataPreProcess.cs @@ -179,8 +179,17 @@ namespace Duplicati.Library.Main.Operation.Backup // Not all reparse points are symlinks.
// For example, on Windows 10 Fall Creator's Update, the OneDrive folder (and all subfolders)
// are reparse points, which allows the folder to hook into the OneDrive service and download things on-demand.
- // If we can't find a symlink target for the current path, we won't treat it as a symlink.
- string symlinkTarget = snapshot.GetSymlinkTarget(path);
+ // If we can't find a symlink target for the current path, we won't treat it as a symlink.
+ string symlinkTarget = null;
+ try
+ {
+ symlinkTarget = snapshot.GetSymlinkTarget(path);
+ }
+ catch (Exception ex)
+ {
+ Logging.Log.WriteExplicitMessage(FILELOGTAG, "SymlinkTargetReadFailure", ex, "Failed to read symlink target for path: {0}", path);
+ }
+
if (!string.IsNullOrWhiteSpace(symlinkTarget))
{
if (options.SymlinkPolicy == Options.SymlinkStrategy.Ignore)
|