Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Skovhede <kenneth@hexad.dk>2016-11-03 15:11:53 +0300
committerKenneth Skovhede <kenneth@hexad.dk>2016-11-03 15:11:53 +0300
commit1f7110503a25572a5070eb4913d9a485a6f44052 (patch)
tree3e88ff01d08558237812754b3ef4501f698ca41d /Duplicati/Library
parent836d59105816df20022fd0ff4fd4e28364638383 (diff)
Updated unix symlinks handling to store correct metadata for symlinks
Diffstat (limited to 'Duplicati/Library')
-rw-r--r--Duplicati/Library/Main/Operation/BackupHandler.cs2
-rw-r--r--Duplicati/Library/Snapshots/ISnapshotService.cs4
-rw-r--r--Duplicati/Library/Snapshots/ISystemIO.cs2
-rw-r--r--Duplicati/Library/Snapshots/LinuxSnapshot.cs6
-rw-r--r--Duplicati/Library/Snapshots/NoSnapshot.cs6
-rw-r--r--Duplicati/Library/Snapshots/NoSnapshotLinux.cs6
-rw-r--r--Duplicati/Library/Snapshots/NoSnapshotWindows.cs6
-rw-r--r--Duplicati/Library/Snapshots/SystemIOLinux.cs4
-rw-r--r--Duplicati/Library/Snapshots/SystemIOWindows.cs2
-rw-r--r--Duplicati/Library/Snapshots/WindowsSnapshot.cs6
10 files changed, 28 insertions, 16 deletions
diff --git a/Duplicati/Library/Main/Operation/BackupHandler.cs b/Duplicati/Library/Main/Operation/BackupHandler.cs
index e4a90b082..90e5df11a 100644
--- a/Duplicati/Library/Main/Operation/BackupHandler.cs
+++ b/Duplicati/Library/Main/Operation/BackupHandler.cs
@@ -835,7 +835,7 @@ namespace Duplicati.Library.Main.Operation
if (m_options.StoreMetadata)
{
- metadata = snapshot.GetMetadata(path);
+ metadata = snapshot.GetMetadata(path, attributes.HasFlag(System.IO.FileAttributes.ReparsePoint), m_symlinkPolicy == Options.SymlinkStrategy.Follow);
if (metadata == null)
metadata = new Dictionary<string, string>();
diff --git a/Duplicati/Library/Snapshots/ISnapshotService.cs b/Duplicati/Library/Snapshots/ISnapshotService.cs
index 2060a466e..314e8b66e 100644
--- a/Duplicati/Library/Snapshots/ISnapshotService.cs
+++ b/Duplicati/Library/Snapshots/ISnapshotService.cs
@@ -81,7 +81,9 @@ namespace Duplicati.Library.Snapshots
/// </summary>
/// <returns>The metadata for the given file or folder</returns>
/// <param name="file">The file or folder to examine</param>
- Dictionary<string, string> GetMetadata(string file);
+ /// <param name="isSymlink">A flag indicating if the target is a symlink</param>
+ /// <param name="followSymlink">A flag indicating if a symlink should be followed</param>
+ Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink);
/// <summary>
/// Gets a value indicating if the path points to a block device
diff --git a/Duplicati/Library/Snapshots/ISystemIO.cs b/Duplicati/Library/Snapshots/ISystemIO.cs
index 417f0698b..cf3fef902 100644
--- a/Duplicati/Library/Snapshots/ISystemIO.cs
+++ b/Duplicati/Library/Snapshots/ISystemIO.cs
@@ -57,7 +57,7 @@ namespace Duplicati.Library.Snapshots
IEnumerable<string> EnumerateFileSystemEntries(string path);
void SetMetadata(string path, Dictionary<string, string> metdata, bool restorePermissions);
- Dictionary<string, string> GetMetadata(string path);
+ Dictionary<string, string> GetMetadata(string path, bool isSymlink, bool followSymlink);
}
}
diff --git a/Duplicati/Library/Snapshots/LinuxSnapshot.cs b/Duplicati/Library/Snapshots/LinuxSnapshot.cs
index 8978cfa26..e2a5d6b08 100644
--- a/Duplicati/Library/Snapshots/LinuxSnapshot.cs
+++ b/Duplicati/Library/Snapshots/LinuxSnapshot.cs
@@ -463,10 +463,12 @@ namespace Duplicati.Library.Snapshots
/// </summary>
/// <returns>The metadata for the given file or folder</returns>
/// <param name="file">The file or folder to examine</param>
- public Dictionary<string, string> GetMetadata(string file)
+ /// <param name="isSymlink">A flag indicating if the target is a symlink</param>
+ /// <param name="followSymlink">A flag indicating if a symlink should be followed</param>
+ public Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink)
{
var local = ConvertToSnapshotPath(FindSnapShotByLocalPath(file), file);
- return _sysIO.GetMetadata(local);
+ return _sysIO.GetMetadata(local, isSymlink, followSymlink);
}
/// <summary>
diff --git a/Duplicati/Library/Snapshots/NoSnapshot.cs b/Duplicati/Library/Snapshots/NoSnapshot.cs
index bd228a3e0..edfca74ba 100644
--- a/Duplicati/Library/Snapshots/NoSnapshot.cs
+++ b/Duplicati/Library/Snapshots/NoSnapshot.cs
@@ -176,7 +176,9 @@ namespace Duplicati.Library.Snapshots
/// </summary>
/// <returns>The metadata for the given file or folder</returns>
/// <param name="file">The file or folder to examine</param>
- public abstract Dictionary<string, string> GetMetadata(string file);
+ /// <param name="isSymlink">A flag indicating if the target is a symlink</param>
+ /// <param name="followSymlink">A flag indicating if a symlink should be followed</param>
+ public abstract Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink);
/// <summary>
/// Gets a value indicating if the path points to a block device
@@ -189,7 +191,7 @@ namespace Duplicati.Library.Snapshots
/// Gets a unique hardlink target ID
/// </summary>
/// <returns>The hardlink ID</returns>
- /// <param name="file">The file or folder to examine</param>
+ /// <param name="path">The file or folder to examine</param>
public abstract string HardlinkTargetID(string path);
#endregion
}
diff --git a/Duplicati/Library/Snapshots/NoSnapshotLinux.cs b/Duplicati/Library/Snapshots/NoSnapshotLinux.cs
index cd586349e..a6d18c3b7 100644
--- a/Duplicati/Library/Snapshots/NoSnapshotLinux.cs
+++ b/Duplicati/Library/Snapshots/NoSnapshotLinux.cs
@@ -53,9 +53,11 @@ namespace Duplicati.Library.Snapshots
/// </summary>
/// <returns>The metadata for the given file or folder</returns>
/// <param name="file">The file or folder to examine</param>
- public override Dictionary<string, string> GetMetadata(string file)
+ /// <param name="isSymlink">A flag indicating if the target is a symlink</param>
+ /// <param name="followSymlink">A flag indicating if a symlink should be followed</param>
+ public override Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink)
{
- return _sysIO.GetMetadata(file);
+ return _sysIO.GetMetadata(file, isSymlink, followSymlink);
}
/// <summary>
diff --git a/Duplicati/Library/Snapshots/NoSnapshotWindows.cs b/Duplicati/Library/Snapshots/NoSnapshotWindows.cs
index 00cb23c86..e708042ac 100644
--- a/Duplicati/Library/Snapshots/NoSnapshotWindows.cs
+++ b/Duplicati/Library/Snapshots/NoSnapshotWindows.cs
@@ -146,9 +146,11 @@ namespace Duplicati.Library.Snapshots
/// </summary>
/// <returns>The metadata for the given file or folder</returns>
/// <param name="file">The file or folder to examine</param>
- public override Dictionary<string, string> GetMetadata(string file)
+ /// <param name="isSymlink">A flag indicating if the target is a symlink</param>
+ /// <param name="followSymlink">A flag indicating if a symlink should be followed</param>
+ public override Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink)
{
- return m_sysIO.GetMetadata(file);
+ return m_sysIO.GetMetadata(file, isSymlink, followSymlink);
}
/// <summary>
diff --git a/Duplicati/Library/Snapshots/SystemIOLinux.cs b/Duplicati/Library/Snapshots/SystemIOLinux.cs
index d6e8e1a72..2e05cabc9 100644
--- a/Duplicati/Library/Snapshots/SystemIOLinux.cs
+++ b/Duplicati/Library/Snapshots/SystemIOLinux.cs
@@ -165,12 +165,12 @@ namespace Duplicati.Library.Snapshots
Directory.Delete(NoSnapshot.NormalizePath(path), recursive);
}
- public Dictionary<string, string> GetMetadata(string file)
+ public Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink)
{
var f = NoSnapshot.NormalizePath(file);
var dict = new Dictionary<string, string>();
- var n = UnixSupport.File.GetExtendedAttributes(f);
+ var n = UnixSupport.File.GetExtendedAttributes(f, isSymlink, followSymlink);
if (n != null)
foreach(var x in n)
dict["unix-ext:" + x.Key] = Convert.ToBase64String(x.Value);
diff --git a/Duplicati/Library/Snapshots/SystemIOWindows.cs b/Duplicati/Library/Snapshots/SystemIOWindows.cs
index cba47b071..c4b3cc44c 100644
--- a/Duplicati/Library/Snapshots/SystemIOWindows.cs
+++ b/Duplicati/Library/Snapshots/SystemIOWindows.cs
@@ -500,7 +500,7 @@ namespace Duplicati.Library.Snapshots
Alphaleonis.Win32.Filesystem.Directory.SetAccessControl(PrefixWithUNC(path), rules, AccessControlSections.All);
}
- public Dictionary<string, string> GetMetadata(string path)
+ public Dictionary<string, string> GetMetadata(string path, bool isSymlink, bool followSymlink)
{
var isDirTarget = path.EndsWith(DIRSEP);
var targetpath = isDirTarget ? path.Substring(0, path.Length - 1) : path;
diff --git a/Duplicati/Library/Snapshots/WindowsSnapshot.cs b/Duplicati/Library/Snapshots/WindowsSnapshot.cs
index 78fd4b343..fd3f4d3ee 100644
--- a/Duplicati/Library/Snapshots/WindowsSnapshot.cs
+++ b/Duplicati/Library/Snapshots/WindowsSnapshot.cs
@@ -394,9 +394,11 @@ namespace Duplicati.Library.Snapshots
/// </summary>
/// <returns>The metadata for the given file or folder</returns>
/// <param name="file">The file or folder to examine</param>
- public Dictionary<string, string> GetMetadata(string file)
+ /// <param name="isSymlink">A flag indicating if the target is a symlink</param>
+ /// <param name="followSymlink">A flag indicating if a symlink should be followed</param>
+ public Dictionary<string, string> GetMetadata(string file, bool isSymlink, bool followSymlink)
{
- return _ioWin.GetMetadata(GetSnapshotPath(file));
+ return _ioWin.GetMetadata(GetSnapshotPath(file), isSymlink, followSymlink);
}
/// <summary>