Merge pull request #1053 from AudriusButkevicius/symdis

Add option to disable symlinks (fixes #1017)
This commit is contained in:
Jakob Borg
2014-12-01 11:22:04 +01:00
5 changed files with 10 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ import (
"github.com/syncthing/syncthing/internal/model"
"github.com/syncthing/syncthing/internal/osutil"
"github.com/syncthing/syncthing/internal/protocol"
"github.com/syncthing/syncthing/internal/symlinks"
"github.com/syncthing/syncthing/internal/upgrade"
"github.com/syncthing/syncthing/internal/upnp"
"github.com/syndtr/goleveldb/leveldb"
@@ -457,6 +458,10 @@ func syncthingMain() {
opts := cfg.Options()
if opts.DisableSymlinks {
symlinks.Supported = false
}
if opts.MaxSendKbps > 0 {
writeRateLimit = ratelimit.NewBucketWithRate(float64(1000*opts.MaxSendKbps), int64(5*1000*opts.MaxSendKbps))
}

View File

@@ -179,6 +179,7 @@ type OptionsConfiguration struct {
KeepTemporariesH int `xml:"keepTemporariesH" default:"24"` // 0 for off
CacheIgnoredFiles bool `xml:"cacheIgnoredFiles" default:"true"`
ProgressUpdateIntervalS int `xml:"progressUpdateIntervalS" default:"5"`
DisableSymlinks bool `xml:"disableSymlinks" default:"false"`
Deprecated_RescanIntervalS int `xml:"rescanIntervalS,omitempty" json:"-"`
Deprecated_UREnabled bool `xml:"urEnabled,omitempty" json:"-"`

View File

@@ -53,6 +53,7 @@ func TestDefaultValues(t *testing.T) {
KeepTemporariesH: 24,
CacheIgnoredFiles: true,
ProgressUpdateIntervalS: 5,
DisableSymlinks: false,
}
cfg := New(device1)
@@ -155,6 +156,7 @@ func TestOverriddenValues(t *testing.T) {
KeepTemporariesH: 48,
CacheIgnoredFiles: false,
ProgressUpdateIntervalS: 10,
DisableSymlinks: true,
}
cfg, err := Load("testdata/overridenvalues.xml", device1)

View File

@@ -20,5 +20,6 @@
<keepTemporariesH>48</keepTemporariesH>
<cacheIgnoredFiles>false</cacheIgnoredFiles>
<progressUpdateIntervalS>10</progressUpdateIntervalS>
<disableSymlinks>true</disableSymlinks>
</options>
</configuration>

View File

@@ -1360,7 +1360,7 @@ func (m *Model) leveldbPanicWorkaround() {
func symlinkInvalid(isLink bool) bool {
if !symlinks.Supported && isLink {
SymlinkWarning.Do(func() {
l.Warnln("Symlinks are unsupported as they require Administrator priviledges. This might cause your folder to appear out of sync.")
l.Warnln("Symlinks are disabled, unsupported or require Administrator priviledges. This might cause your folder to appear out of sync.")
})
return true
}