all: Remove symlink support on Windows, SymlinksEnabled config

After this change,

- Symlinks on Windows are always unsupported. Sorry.

- Symlinks are always enabled on other platforms. They are just a small
  file like anything else. There is no need to special case them. If you
  don't want to sync some symlinks, ignore them.

- The protocol doesn't differentiate between different "types" of
  symlinks. If that distinction ever does become relevant the individual
  devices can figure it out by looking at the destination when they
  create the link.

It's backwards compatible in that all the old symlink types are still
understood to be symlinks, and the new SYMLINK type is equivalent to the
old SYMLINK_UNKNOWN which was always a valid way to do it.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3962
LGTM: AudriusButkevicius
This commit is contained in:
Jakob Borg
2017-02-07 08:34:24 +00:00
parent 9fda9642d3
commit c4ba580cbb
28 changed files with 227 additions and 707 deletions

View File

@@ -16,7 +16,6 @@ import (
"github.com/syncthing/syncthing/lib/config"
"github.com/syncthing/syncthing/lib/protocol"
"github.com/syncthing/syncthing/lib/rc"
"github.com/syncthing/syncthing/lib/symlinks"
)
func TestSymlinks(t *testing.T) {
@@ -107,7 +106,7 @@ func testSymlinks(t *testing.T) {
t.Fatal(err)
}
fd.Close()
err = symlinks.Create("s1/fileLink", "file", 0)
err = os.Symlink("file", "s1/fileLink")
if err != nil {
log.Fatal(err)
}
@@ -118,35 +117,35 @@ func testSymlinks(t *testing.T) {
if err != nil {
t.Fatal(err)
}
err = symlinks.Create("s1/dirLink", "dir", 0)
err = os.Symlink("dir", "s1/dirLink")
if err != nil {
log.Fatal(err)
}
// A link to something in the repo that does not exist
err = symlinks.Create("s1/noneLink", "does/not/exist", 0)
err = os.Symlink("does/not/exist", "s1/noneLink")
if err != nil {
log.Fatal(err)
}
// A link we will replace with a file later
err = symlinks.Create("s1/repFileLink", "does/not/exist", 0)
err = os.Symlink("does/not/exist", "s1/repFileLink")
if err != nil {
log.Fatal(err)
}
// A link we will replace with a directory later
err = symlinks.Create("s1/repDirLink", "does/not/exist", 0)
err = os.Symlink("does/not/exist", "s1/repDirLink")
if err != nil {
log.Fatal(err)
}
// A link we will remove later
err = symlinks.Create("s1/removeLink", "does/not/exist", 0)
err = os.Symlink("does/not/exist", "s1/removeLink")
if err != nil {
log.Fatal(err)
}
@@ -183,7 +182,7 @@ func testSymlinks(t *testing.T) {
if err != nil {
log.Fatal(err)
}
err = symlinks.Create("s1/dirLink", "file", 0)
err = os.Symlink("file", "s1/dirLink")
if err != nil {
log.Fatal(err)
}
@@ -219,7 +218,7 @@ func testSymlinks(t *testing.T) {
if err != nil {
log.Fatal(err)
}
err = symlinks.Create("s1/fileToReplace", "somewhere/non/existent", 0)
err = os.Symlink("somewhere/non/existent", "s1/fileToReplace")
if err != nil {
log.Fatal(err)
}
@@ -230,7 +229,7 @@ func testSymlinks(t *testing.T) {
if err != nil {
log.Fatal(err)
}
err = symlinks.Create("s1/dirToReplace", "somewhere/non/existent", 0)
err = os.Symlink("somewhere/non/existent", "s1/dirToReplace")
if err != nil {
log.Fatal(err)
}