mirror of
https://github.com/syncthing/syncthing.git
synced 2026-01-04 03:49:12 -05:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7221b035d | ||
|
|
a69ba18f62 | ||
|
|
b31611a8d1 | ||
|
|
0ca0e3e9bd | ||
|
|
0a96a1150b | ||
|
|
b8c249cddc | ||
|
|
e8ba6d4771 | ||
|
|
606fce09ca | ||
|
|
3d8b4a42b7 | ||
|
|
ab8c2fb5c7 | ||
|
|
77578e8aac | ||
|
|
1fc2ab444b | ||
|
|
fa5c890ff6 | ||
|
|
a3c17f8f81 | ||
|
|
f1f21bf220 | ||
|
|
54155cb42d | ||
|
|
414c58174b | ||
|
|
94acc20dd6 | ||
|
|
8e9119eedf | ||
|
|
a04b92332f | ||
|
|
0ad10b0fee | ||
|
|
0ca2ed7ad7 | ||
|
|
fa4226cae4 | ||
|
|
cc63236a2e | ||
|
|
6623657ef3 | ||
|
|
4405117bea | ||
|
|
e371800878 | ||
|
|
7a47646534 | ||
|
|
d475ad7ce1 | ||
|
|
7c8418f493 | ||
|
|
200a7fc844 | ||
|
|
5a38e0ba3f | ||
|
|
c77490c32d | ||
|
|
b75c9f2bbb | ||
|
|
322bedbb04 | ||
|
|
487655b365 | ||
|
|
03c678a810 | ||
|
|
b79f8aceb8 | ||
|
|
92e8c4303a | ||
|
|
e735a3a25c | ||
|
|
8d13e01342 | ||
|
|
34f8cc8620 | ||
|
|
add10c98fa | ||
|
|
6503326073 | ||
|
|
db1dc9985a | ||
|
|
3641c97667 | ||
|
|
8f214fe4a9 | ||
|
|
98cfc204ca | ||
|
|
d0061c172c |
7
AUTHORS
7
AUTHORS
@@ -62,15 +62,17 @@ Jaya Chithra (jayachithra) <s.k.jayachithra@gmail.com>
|
||||
Jens Diemer (jedie) <github.com@jensdiemer.de> <git@jensdiemer.de>
|
||||
Jochen Voss (seehuhn) <voss@seehuhn.de>
|
||||
Johan Vromans (sciurius) <jvromans@squirrel.nl>
|
||||
Jose Manuel Delicado (jmdaweb) <jmdaweb@hotmail.com> <jmdaweb@users.noreply.github.com>
|
||||
Karol Różycki (krozycki) <rozycki.karol@gmail.com>
|
||||
Kelong Cong (kc1212) <kc04bc@gmx.com> <kc1212@users.noreply.github.com>
|
||||
Ken'ichi Kamada (kamadak) <kamada@nanohz.org>
|
||||
Kevin Allen (ironmig) <kma1660@gmail.com>
|
||||
Kevin White, Jr. (kwhite17) <kevinwhite1710@gmail.com>
|
||||
Kurt Fitzner (Kudalufi) <kurt@va1der.ca>
|
||||
Kurt Fitzner (Kudalufi) <kurt@va1der.ca> <kurt.fitzner@gmail.com>
|
||||
Lars K.W. Gohlke (lkwg82) <lkwg82@gmx.de>
|
||||
Laurent Etiemble (letiemble) <laurent.etiemble@gmail.com> <laurent.etiemble@monobjc.net>
|
||||
Leo Arias (elopio) <yo@elopio.net>
|
||||
Liu Siyuan (liusy182) <liusy182@gmail.com> <liusy182@hotmail.com>
|
||||
Lode Hoste (Zillode) <zillode@zillode.be>
|
||||
Lord Landon Agahnim (LordLandon) <lordlandon@gmail.com>
|
||||
Majed Abdulaziz (majedev) <majed.alhajry@gmail.com>
|
||||
@@ -93,6 +95,7 @@ Phill Luby (pluby) <phill.luby@newredo.com>
|
||||
Piotr Bejda (piobpl) <piotrb10@gmail.com>
|
||||
Robert Carosi (nov1n) <robert@carosi.nl>
|
||||
Roman Zaynetdinov (zaynetro) <romanznet@gmail.com>
|
||||
Ross Smith II (rasa) <ross@smithii.com>
|
||||
Ryan Sullivan (KayoticSully) <kayoticsully@gmail.com>
|
||||
Sacheendra Talluri (sacheendra) <sacheendra.t@gmail.com>
|
||||
Scott Klupfel (kluppy) <kluppy@going2blue.com>
|
||||
@@ -112,6 +115,6 @@ Veeti Paananen (veeti) <veeti.paananen@rojekti.fi>
|
||||
Victor Buinsky (buinsky) <vix_booja@tut.by>
|
||||
Vil Brekin (Vilbrekin) <vilbrekin@gmail.com>
|
||||
William A. Kennington III (wkennington) <william@wkennington.com>
|
||||
Wulf Weich (wweich) <wweich@users.noreply.github.com> <wweich@gmx.de>
|
||||
Wulf Weich (wweich) <wweich@users.noreply.github.com> <wweich@gmx.de> <wulf@weich-kr.de>
|
||||
Xavier O. (damajor) <damajor@gmail.com>
|
||||
Yannic A. (eipiminus1) <eipiminusone+github@gmail.com> <eipiminus1@users.noreply.github.com>
|
||||
|
||||
7
NICKS
7
NICKS
@@ -57,6 +57,8 @@ jayachithra <s.k.jayachithra@gmail.com>
|
||||
jedie <github.com@jensdiemer.de>
|
||||
jedie <git@jensdiemer.de>
|
||||
jgke <jgke@jgke.fi>
|
||||
jmdaweb <jmdaweb@hotmail.com>
|
||||
jmdaweb <jmdaweb@users.noreply.github.com>
|
||||
jpjp <jamespatterson@operamail.com>
|
||||
jpjp <jpjp@users.noreply.github.com>
|
||||
kamadak <kamada@nanohz.org>
|
||||
@@ -70,9 +72,12 @@ kralo <max.schulze@online.de>
|
||||
kralo <kralo@users.noreply.github.com>
|
||||
krozycki <rozycki.karol@gmail.com>
|
||||
Kudalufi <kurt@va1der.ca>
|
||||
Kudalufi <kurt.fitzner@gmail.com>
|
||||
kwhite17 <kevinwhite1710@gmail.com>
|
||||
letiemble <laurent.etiemble@gmail.com>
|
||||
letiemble <laurent.etiemble@monobjc.net>
|
||||
liusy182 <liusy182@gmail.com>
|
||||
liusy182 <liusy182@hotmail.com>
|
||||
lkwg82 <lkwg82@gmx.de>
|
||||
LordLandon <lordlandon@gmail.com>
|
||||
majedev <majed.alhajry@gmail.com>
|
||||
@@ -106,6 +111,7 @@ ProactiveServices <ProactiveServices@users.noreply.github.com>
|
||||
pyfisch <pyfisch@gmail.com>
|
||||
qbit <qbit@deftly.net>
|
||||
ralder <ralder@yandex.ru>
|
||||
rasa <ross@smithii.com>
|
||||
Rewt0r <rewt0r@gmx.com>
|
||||
Rewt0r <Rewt0r@users.noreply.github.com>
|
||||
rumpelsepp <stefan@sevenbyte.org>
|
||||
@@ -136,6 +142,7 @@ wkennington <william@wkennington.com>
|
||||
WSGCSysadmin <e.meitner@willystreet.coop>
|
||||
wweich <wweich@users.noreply.github.com>
|
||||
wweich <wweich@gmx.de>
|
||||
wweich <wulf@weich-kr.de>
|
||||
xduugu <cedric@gmx.ca>
|
||||
zaynetro <romanznet@gmail.com>
|
||||
Zillode <zillode@zillode.be>
|
||||
|
||||
@@ -100,7 +100,7 @@ All code is licensed under the [MPLv2 License][7].
|
||||
[1]: https://docs.syncthing.net/specs/bep-v1.html
|
||||
[2]: https://docs.syncthing.net/intro/getting-started.html
|
||||
[3]: https://github.com/syncthing/syncthing/blob/master/etc
|
||||
[4]: http://www.freenode.net/
|
||||
[4]: https://www.freenode.net/
|
||||
[5]: https://docs.syncthing.net/dev/building.html
|
||||
[6]: https://docs.syncthing.net/
|
||||
[7]: https://github.com/syncthing/syncthing/blob/master/LICENSE
|
||||
|
||||
BIN
assets/syncthing_folder_icon.icns
Normal file
BIN
assets/syncthing_folder_icon.icns
Normal file
Binary file not shown.
358
build.go
358
build.go
@@ -12,7 +12,9 @@ import (
|
||||
"archive/tar"
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"compress/flate"
|
||||
"compress/gzip"
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -32,14 +34,17 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
versionRe = regexp.MustCompile(`-[0-9]{1,3}-g[0-9a-f]{5,10}`)
|
||||
goarch string
|
||||
goos string
|
||||
noupgrade bool
|
||||
version string
|
||||
goVersion float64
|
||||
race bool
|
||||
debug = os.Getenv("BUILDDEBUG") != ""
|
||||
versionRe = regexp.MustCompile(`-[0-9]{1,3}-g[0-9a-f]{5,10}`)
|
||||
goarch string
|
||||
goos string
|
||||
noupgrade bool
|
||||
version string
|
||||
goVersion float64
|
||||
race bool
|
||||
debug = os.Getenv("BUILDDEBUG") != ""
|
||||
noBuildGopath bool
|
||||
extraTags string
|
||||
installSuffix string
|
||||
)
|
||||
|
||||
type target struct {
|
||||
@@ -65,7 +70,7 @@ var targets = map[string]target{
|
||||
"all": {
|
||||
// Only valid for the "build" and "install" commands as it lacks all
|
||||
// the archive creation stuff.
|
||||
buildPkg: "./cmd/...",
|
||||
buildPkg: "github.com/syncthing/syncthing/cmd/...",
|
||||
tags: []string{"purego"},
|
||||
},
|
||||
"syncthing": {
|
||||
@@ -75,7 +80,7 @@ var targets = map[string]target{
|
||||
debdeps: []string{"libc6", "procps"},
|
||||
debpost: "script/post-upgrade",
|
||||
description: "Open Source Continuous File Synchronization",
|
||||
buildPkg: "./cmd/syncthing",
|
||||
buildPkg: "github.com/syncthing/syncthing/cmd/syncthing",
|
||||
binaryName: "syncthing", // .exe will be added automatically for Windows builds
|
||||
archiveFiles: []archiveFile{
|
||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||
@@ -110,7 +115,7 @@ var targets = map[string]target{
|
||||
debname: "syncthing-discosrv",
|
||||
debdeps: []string{"libc6"},
|
||||
description: "Syncthing Discovery Server",
|
||||
buildPkg: "./cmd/stdiscosrv",
|
||||
buildPkg: "github.com/syncthing/syncthing/cmd/stdiscosrv",
|
||||
binaryName: "stdiscosrv", // .exe will be added automatically for Windows builds
|
||||
archiveFiles: []archiveFile{
|
||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||
@@ -132,7 +137,7 @@ var targets = map[string]target{
|
||||
debname: "syncthing-relaysrv",
|
||||
debdeps: []string{"libc6"},
|
||||
description: "Syncthing Relay Server",
|
||||
buildPkg: "./cmd/strelaysrv",
|
||||
buildPkg: "github.com/syncthing/syncthing/cmd/strelaysrv",
|
||||
binaryName: "strelaysrv", // .exe will be added automatically for Windows builds
|
||||
archiveFiles: []archiveFile{
|
||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||
@@ -153,7 +158,7 @@ var targets = map[string]target{
|
||||
debname: "syncthing-relaypoolsrv",
|
||||
debdeps: []string{"libc6"},
|
||||
description: "Syncthing Relay Pool Server",
|
||||
buildPkg: "./cmd/strelaypoolsrv",
|
||||
buildPkg: "github.com/syncthing/syncthing/cmd/strelaypoolsrv",
|
||||
binaryName: "strelaypoolsrv", // .exe will be added automatically for Windows builds
|
||||
archiveFiles: []archiveFile{
|
||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||
@@ -170,41 +175,6 @@ var targets = map[string]target{
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
// fast linters complete in a fraction of a second and might as well be
|
||||
// run always as part of the build
|
||||
fastLinters = []string{
|
||||
"deadcode",
|
||||
"golint",
|
||||
"ineffassign",
|
||||
"vet",
|
||||
}
|
||||
|
||||
// slow linters take several seconds and are run only as part of the
|
||||
// "metalint" command.
|
||||
slowLinters = []string{
|
||||
"gosimple",
|
||||
"staticcheck",
|
||||
"structcheck",
|
||||
"unused",
|
||||
"varcheck",
|
||||
}
|
||||
|
||||
// Which parts of the tree to lint
|
||||
lintDirs = []string{".", "./lib/...", "./cmd/..."}
|
||||
|
||||
// Messages to ignore
|
||||
lintExcludes = []string{
|
||||
".pb.go",
|
||||
"should have comment",
|
||||
"protocol.Vector composite literal uses unkeyed fields",
|
||||
"cli.Requires composite literal uses unkeyed fields",
|
||||
"Use DialContext instead", // Go 1.7
|
||||
"os.SEEK_SET is deprecated", // Go 1.7
|
||||
"SA4017", // staticcheck "is a pure function but its return value is ignored"
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
// The "syncthing" target includes a few more files found in the "etc"
|
||||
// and "extra" dirs.
|
||||
@@ -222,9 +192,10 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.SetOutput(os.Stdout)
|
||||
log.SetFlags(0)
|
||||
|
||||
parseFlags()
|
||||
|
||||
if debug {
|
||||
t0 := time.Now()
|
||||
defer func() {
|
||||
@@ -232,16 +203,25 @@ func main() {
|
||||
}()
|
||||
}
|
||||
|
||||
if os.Getenv("GOPATH") == "" {
|
||||
setGoPath()
|
||||
if gopath() == "" {
|
||||
gopath, err := temporaryBuildDir()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if !noBuildGopath {
|
||||
lazyRebuildAssets()
|
||||
if err := buildGOPATH(gopath); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
os.Setenv("GOPATH", gopath)
|
||||
log.Println("GOPATH is", gopath)
|
||||
}
|
||||
|
||||
// Set path to $GOPATH/bin:$PATH so that we can for sure find tools we
|
||||
// might have installed during "build.go setup".
|
||||
os.Setenv("PATH", fmt.Sprintf("%s%cbin%c%s", os.Getenv("GOPATH"), os.PathSeparator, os.PathListSeparator, os.Getenv("PATH")))
|
||||
|
||||
parseFlags()
|
||||
|
||||
checkArchitecture()
|
||||
|
||||
// Invoking build.go with no parameters at all builds everything (incrementally),
|
||||
@@ -284,22 +264,23 @@ func runCommand(cmd string, target target) {
|
||||
if noupgrade {
|
||||
tags = []string{"noupgrade"}
|
||||
}
|
||||
tags = append(tags, strings.Fields(extraTags)...)
|
||||
install(target, tags)
|
||||
metalint(fastLinters, lintDirs)
|
||||
metalintShort()
|
||||
|
||||
case "build":
|
||||
var tags []string
|
||||
if noupgrade {
|
||||
tags = []string{"noupgrade"}
|
||||
}
|
||||
tags = append(tags, strings.Fields(extraTags)...)
|
||||
build(target, tags)
|
||||
metalint(fastLinters, lintDirs)
|
||||
|
||||
case "test":
|
||||
test("./lib/...", "./cmd/...")
|
||||
test("github.com/syncthing/syncthing/lib/...", "github.com/syncthing/syncthing/cmd/...")
|
||||
|
||||
case "bench":
|
||||
bench("./lib/...", "./cmd/...")
|
||||
bench("github.com/syncthing/syncthing/lib/...", "github.com/syncthing/syncthing/cmd/...")
|
||||
|
||||
case "assets":
|
||||
rebuildAssets()
|
||||
@@ -329,41 +310,38 @@ func runCommand(cmd string, target target) {
|
||||
clean()
|
||||
|
||||
case "vet":
|
||||
metalint(fastLinters, lintDirs)
|
||||
metalintShort()
|
||||
|
||||
case "lint":
|
||||
metalint(fastLinters, lintDirs)
|
||||
metalintShort()
|
||||
|
||||
case "metalint":
|
||||
metalint(fastLinters, lintDirs)
|
||||
metalint(slowLinters, lintDirs)
|
||||
metalint()
|
||||
|
||||
case "version":
|
||||
fmt.Println(getVersion())
|
||||
|
||||
case "gopath":
|
||||
gopath, err := temporaryBuildDir()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(gopath)
|
||||
|
||||
default:
|
||||
log.Fatalf("Unknown command %q", cmd)
|
||||
}
|
||||
}
|
||||
|
||||
// setGoPath sets GOPATH correctly with the assumption that we are
|
||||
// in $GOPATH/src/github.com/syncthing/syncthing.
|
||||
func setGoPath() {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
gopath := filepath.Clean(filepath.Join(cwd, "../../../../"))
|
||||
log.Println("GOPATH is", gopath)
|
||||
os.Setenv("GOPATH", gopath)
|
||||
}
|
||||
|
||||
func parseFlags() {
|
||||
flag.StringVar(&goarch, "goarch", runtime.GOARCH, "GOARCH")
|
||||
flag.StringVar(&goos, "goos", runtime.GOOS, "GOOS")
|
||||
flag.BoolVar(&noupgrade, "no-upgrade", noupgrade, "Disable upgrade functionality")
|
||||
flag.StringVar(&version, "version", getVersion(), "Set compiled in version string")
|
||||
flag.BoolVar(&race, "race", race, "Use race detector")
|
||||
flag.BoolVar(&noBuildGopath, "no-build-gopath", noBuildGopath, "Don't build GOPATH, assume it's OK")
|
||||
flag.StringVar(&extraTags, "tags", extraTags, "Extra tags, space separated")
|
||||
flag.StringVar(&installSuffix, "installsuffix", installSuffix, "Install suffix, optional")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
@@ -390,7 +368,7 @@ func setup() {
|
||||
runPrint("go", "get", "-u", pkg)
|
||||
}
|
||||
|
||||
runPrint("go", "install", "-v", "./vendor/github.com/gogo/protobuf/protoc-gen-gogofast")
|
||||
runPrint("go", "install", "-v", "github.com/syncthing/syncthing/vendor/github.com/gogo/protobuf/protoc-gen-gogofast")
|
||||
}
|
||||
|
||||
func test(pkgs ...string) {
|
||||
@@ -429,6 +407,9 @@ func install(target target, tags []string) {
|
||||
if len(tags) > 0 {
|
||||
args = append(args, "-tags", strings.Join(tags, " "))
|
||||
}
|
||||
if installSuffix != "" {
|
||||
args = append(args, "-installsuffix", installSuffix)
|
||||
}
|
||||
if race {
|
||||
args = append(args, "-race")
|
||||
}
|
||||
@@ -444,11 +425,14 @@ func build(target target, tags []string) {
|
||||
|
||||
tags = append(target.tags, tags...)
|
||||
|
||||
rmr(target.binaryName)
|
||||
rmr(target.BinaryName())
|
||||
args := []string{"build", "-i", "-v", "-ldflags", ldflags()}
|
||||
if len(tags) > 0 {
|
||||
args = append(args, "-tags", strings.Join(tags, " "))
|
||||
}
|
||||
if installSuffix != "" {
|
||||
args = append(args, "-installsuffix", installSuffix)
|
||||
}
|
||||
if race {
|
||||
args = append(args, "-race")
|
||||
}
|
||||
@@ -472,22 +456,20 @@ func buildTar(target target) {
|
||||
build(target, tags)
|
||||
|
||||
if goos == "darwin" {
|
||||
macosCodesign(target.binaryName)
|
||||
macosCodesign(target.BinaryName())
|
||||
}
|
||||
|
||||
for i := range target.archiveFiles {
|
||||
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.binaryName, 1)
|
||||
target.archiveFiles[i].dst = strings.Replace(target.archiveFiles[i].dst, "{{binary}}", target.binaryName, 1)
|
||||
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
||||
target.archiveFiles[i].dst = strings.Replace(target.archiveFiles[i].dst, "{{binary}}", target.BinaryName(), 1)
|
||||
target.archiveFiles[i].dst = name + "/" + target.archiveFiles[i].dst
|
||||
}
|
||||
|
||||
tarGz(filename, target.archiveFiles)
|
||||
log.Println(filename)
|
||||
fmt.Println(filename)
|
||||
}
|
||||
|
||||
func buildZip(target target) {
|
||||
target.binaryName += ".exe"
|
||||
|
||||
name := archiveName(target)
|
||||
filename := name + ".zip"
|
||||
|
||||
@@ -500,13 +482,13 @@ func buildZip(target target) {
|
||||
build(target, tags)
|
||||
|
||||
for i := range target.archiveFiles {
|
||||
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.binaryName, 1)
|
||||
target.archiveFiles[i].dst = strings.Replace(target.archiveFiles[i].dst, "{{binary}}", target.binaryName, 1)
|
||||
target.archiveFiles[i].src = strings.Replace(target.archiveFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
||||
target.archiveFiles[i].dst = strings.Replace(target.archiveFiles[i].dst, "{{binary}}", target.BinaryName(), 1)
|
||||
target.archiveFiles[i].dst = name + "/" + target.archiveFiles[i].dst
|
||||
}
|
||||
|
||||
zipFile(filename, target.archiveFiles)
|
||||
log.Println(filename)
|
||||
fmt.Println(filename)
|
||||
}
|
||||
|
||||
func buildDeb(target target) {
|
||||
@@ -526,8 +508,8 @@ func buildDeb(target target) {
|
||||
build(target, []string{"noupgrade"})
|
||||
|
||||
for i := range target.installationFiles {
|
||||
target.installationFiles[i].src = strings.Replace(target.installationFiles[i].src, "{{binary}}", target.binaryName, 1)
|
||||
target.installationFiles[i].dst = strings.Replace(target.installationFiles[i].dst, "{{binary}}", target.binaryName, 1)
|
||||
target.installationFiles[i].src = strings.Replace(target.installationFiles[i].src, "{{binary}}", target.BinaryName(), 1)
|
||||
target.installationFiles[i].dst = strings.Replace(target.installationFiles[i].dst, "{{binary}}", target.BinaryName(), 1)
|
||||
}
|
||||
|
||||
for _, af := range target.installationFiles {
|
||||
@@ -605,21 +587,36 @@ func buildSnap(target target) {
|
||||
runPrint("snapcraft")
|
||||
}
|
||||
|
||||
// copyFile copies a file from src to dst, ensuring the containing directory
|
||||
// exists. The permission bits are copied as well. If dst already exists and
|
||||
// the contents are identical to src the modification time is not updated.
|
||||
func copyFile(src, dst string, perm os.FileMode) error {
|
||||
dstDir := filepath.Dir(dst)
|
||||
os.MkdirAll(dstDir, 0755) // ignore error
|
||||
srcFd, err := os.Open(src)
|
||||
in, err := ioutil.ReadFile(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer srcFd.Close()
|
||||
dstFd, err := os.OpenFile(dst, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, perm)
|
||||
|
||||
out, err := ioutil.ReadFile(dst)
|
||||
if err != nil {
|
||||
// The destination probably doesn't exist, we should create
|
||||
// it.
|
||||
goto copy
|
||||
}
|
||||
|
||||
if bytes.Equal(in, out) {
|
||||
// The permission bits may have changed without the contents
|
||||
// changing so we always mirror them.
|
||||
os.Chmod(dst, perm)
|
||||
return nil
|
||||
}
|
||||
|
||||
copy:
|
||||
os.MkdirAll(filepath.Dir(dst), 0777)
|
||||
if err := ioutil.WriteFile(dst, in, perm); err != nil {
|
||||
return err
|
||||
}
|
||||
defer dstFd.Close()
|
||||
_, err = io.Copy(dstFd, srcFd)
|
||||
return err
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func listFiles(dir string) []string {
|
||||
@@ -674,7 +671,7 @@ func shouldRebuildAssets(target, srcdir string) bool {
|
||||
}
|
||||
|
||||
func proto() {
|
||||
runPrint("go", "generate", "./lib/...")
|
||||
runPrint("go", "generate", "github.com/syncthing/syncthing/lib/...")
|
||||
}
|
||||
|
||||
func translate() {
|
||||
@@ -801,8 +798,9 @@ func getBranchSuffix() string {
|
||||
}
|
||||
|
||||
branch = parts[len(parts)-1]
|
||||
if branch == "master" {
|
||||
// master builds are the default.
|
||||
switch branch {
|
||||
case "master", "release":
|
||||
// these are not special
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -926,7 +924,10 @@ func tarGz(out string, files []archiveFile) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
gw := gzip.NewWriter(fd)
|
||||
gw, err := gzip.NewWriterLevel(fd, gzip.BestCompression)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
tw := tar.NewWriter(gw)
|
||||
|
||||
for _, f := range files {
|
||||
@@ -979,6 +980,21 @@ func zipFile(out string, files []archiveFile) {
|
||||
|
||||
zw := zip.NewWriter(fd)
|
||||
|
||||
var fw *flate.Writer
|
||||
|
||||
// Register the deflator.
|
||||
zw.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) {
|
||||
var err error
|
||||
if fw == nil {
|
||||
// Creating a flate compressor for every file is
|
||||
// expensive, create one and reuse it.
|
||||
fw, err = flate.NewWriter(out, flate.BestCompression)
|
||||
} else {
|
||||
fw.Reset(out)
|
||||
}
|
||||
return fw, err
|
||||
})
|
||||
|
||||
for _, f := range files {
|
||||
sf, err := os.Open(f.src)
|
||||
if err != nil {
|
||||
@@ -1054,59 +1070,129 @@ func macosCodesign(file string) {
|
||||
}
|
||||
}
|
||||
|
||||
func metalint(linters []string, dirs []string) {
|
||||
ok := true
|
||||
if isGometalinterInstalled() {
|
||||
if !gometalinter(linters, dirs, lintExcludes...) {
|
||||
ok = false
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
log.Fatal("Build succeeded, but there were lint warnings")
|
||||
}
|
||||
func metalint() {
|
||||
lazyRebuildAssets()
|
||||
runPrint("go", "test", "-run", "Metalint", "./meta")
|
||||
}
|
||||
|
||||
func isGometalinterInstalled() bool {
|
||||
if _, err := runError("gometalinter", "--disable-all"); err != nil {
|
||||
log.Println("gometalinter is not installed")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
func metalintShort() {
|
||||
lazyRebuildAssets()
|
||||
runPrint("go", "test", "-short", "-run", "Metalint", "./meta")
|
||||
}
|
||||
|
||||
func gometalinter(linters []string, dirs []string, excludes ...string) bool {
|
||||
params := []string{"--disable-all", "--concurrency=2", "--deadline=300s"}
|
||||
func temporaryBuildDir() (string, error) {
|
||||
// The base of our temp dir is "syncthing-xxxxxxxx" where the x:es
|
||||
// are eight bytes from the sha256 of our working directory. We do
|
||||
// this because we want a name in the global temp dir that doesn't
|
||||
// conflict with someone else building syncthing on the same
|
||||
// machine, yet is persistent between runs from the same source
|
||||
// directory.
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
hash := sha256.Sum256([]byte(wd))
|
||||
base := fmt.Sprintf("syncthing-%x", hash[:4])
|
||||
|
||||
for _, linter := range linters {
|
||||
params = append(params, "--enable="+linter)
|
||||
// The temp dir is taken from $STTMPDIR if set, otherwise the system
|
||||
// default (potentially infrluenced by $TMPDIR on unixes).
|
||||
var tmpDir string
|
||||
if t := os.Getenv("STTMPDIR"); t != "" {
|
||||
tmpDir = t
|
||||
} else {
|
||||
tmpDir = os.TempDir()
|
||||
}
|
||||
|
||||
for _, exclude := range excludes {
|
||||
params = append(params, "--exclude="+exclude)
|
||||
return filepath.Join(tmpDir, base), nil
|
||||
}
|
||||
|
||||
func buildGOPATH(gopath string) error {
|
||||
pkg := filepath.Join(gopath, "src/github.com/syncthing/syncthing")
|
||||
dirs := []string{"cmd", "lib", "meta", "script", "test", "vendor"}
|
||||
|
||||
if debug {
|
||||
t0 := time.Now()
|
||||
log.Println("build temporary GOPATH in", gopath)
|
||||
defer func() {
|
||||
log.Println("... in", time.Since(t0))
|
||||
}()
|
||||
}
|
||||
|
||||
// Walk the sources and copy the files into the temporary GOPATH.
|
||||
// Remember which files are supposed to be present so we can clean
|
||||
// out everything else in the next step. The copyFile() step will
|
||||
// only actually copy the file if it doesn't exist or the contents
|
||||
// differ.
|
||||
|
||||
exists := map[string]struct{}{}
|
||||
for _, dir := range dirs {
|
||||
params = append(params, dir)
|
||||
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
dst := filepath.Join(pkg, path)
|
||||
exists[dst] = struct{}{}
|
||||
|
||||
if err := copyFile(path, dst, info.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
bs, _ := runError("gometalinter", params...)
|
||||
// Walk the temporary GOPATH and remove any files that we wouldn't
|
||||
// have copied there in the previous step.
|
||||
|
||||
nerr := 0
|
||||
lines := make(map[string]struct{})
|
||||
for _, line := range strings.Split(string(bs), "\n") {
|
||||
if line == "" {
|
||||
continue
|
||||
filepath.Walk(pkg, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, ok := lines[line]; ok {
|
||||
continue
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
log.Println(line)
|
||||
if strings.Contains(line, "executable file not found") {
|
||||
log.Println(` - Try "go run build.go setup" to install missing tools`)
|
||||
if _, ok := exists[path]; !ok {
|
||||
os.Remove(path)
|
||||
}
|
||||
lines[line] = struct{}{}
|
||||
nerr++
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
return nerr == 0
|
||||
return nil
|
||||
}
|
||||
|
||||
func gopath() string {
|
||||
if gopath := os.Getenv("GOPATH"); gopath != "" {
|
||||
// The env var is set, use that.
|
||||
return gopath
|
||||
}
|
||||
|
||||
// Ask Go what it thinks.
|
||||
bs, err := runError("go", "env", "GOPATH")
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
// We got something. Check if we are in fact available in that location.
|
||||
gopath := string(bs)
|
||||
if _, err := os.Stat(filepath.Join(gopath, "src/github.com/syncthing/syncthing/build.go")); err == nil {
|
||||
// That seems to be the gopath.
|
||||
return gopath
|
||||
}
|
||||
|
||||
// The gopath is not valid.
|
||||
return ""
|
||||
}
|
||||
|
||||
func (t target) BinaryName() string {
|
||||
if goos == "windows" {
|
||||
return t.binaryName + ".exe"
|
||||
}
|
||||
return t.binaryName
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/AudriusButkevicius/cli"
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -102,8 +103,10 @@ func foldersList(c *cli.Context) {
|
||||
if !first {
|
||||
fmt.Fprintln(writer)
|
||||
}
|
||||
fs := folder.Filesystem()
|
||||
fmt.Fprintln(writer, "ID:\t", folder.ID, "\t")
|
||||
fmt.Fprintln(writer, "Path:\t", folder.RawPath, "\t(directory)")
|
||||
fmt.Fprintln(writer, "Path:\t", fs.URI(), "\t(directory)")
|
||||
fmt.Fprintln(writer, "Path type:\t", fs.Type(), "\t(directory-type)")
|
||||
fmt.Fprintln(writer, "Folder type:\t", folder.Type, "\t(type)")
|
||||
fmt.Fprintln(writer, "Ignore permissions:\t", folder.IgnorePerms, "\t(permissions)")
|
||||
fmt.Fprintln(writer, "Rescan interval in seconds:\t", folder.RescanIntervalS, "\t(rescan)")
|
||||
@@ -124,8 +127,9 @@ func foldersAdd(c *cli.Context) {
|
||||
abs, err := filepath.Abs(c.Args()[1])
|
||||
die(err)
|
||||
folder := config.FolderConfiguration{
|
||||
ID: c.Args()[0],
|
||||
RawPath: filepath.Clean(abs),
|
||||
ID: c.Args()[0],
|
||||
Path: filepath.Clean(abs),
|
||||
FilesystemType: fs.FilesystemTypeBasic,
|
||||
}
|
||||
cfg.Folders = append(cfg.Folders, folder)
|
||||
setConfig(c, cfg)
|
||||
@@ -185,7 +189,9 @@ func foldersGet(c *cli.Context) {
|
||||
}
|
||||
switch arg {
|
||||
case "directory":
|
||||
fmt.Println(folder.RawPath)
|
||||
fmt.Println(folder.Filesystem().URI())
|
||||
case "directory-type":
|
||||
fmt.Println(folder.Filesystem().Type())
|
||||
case "type":
|
||||
fmt.Println(folder.Type)
|
||||
case "permissions":
|
||||
@@ -197,7 +203,7 @@ func foldersGet(c *cli.Context) {
|
||||
fmt.Println(folder.Versioning.Type)
|
||||
}
|
||||
default:
|
||||
die("Invalid property: " + c.Args()[1] + "\nAvailable properties: directory, type, permissions, versioning, versioning-<key>")
|
||||
die("Invalid property: " + c.Args()[1] + "\nAvailable properties: directory, directory-type, type, permissions, versioning, versioning-<key>")
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -220,7 +226,11 @@ func foldersSet(c *cli.Context) {
|
||||
}
|
||||
switch arg {
|
||||
case "directory":
|
||||
cfg.Folders[i].RawPath = val
|
||||
cfg.Folders[i].Path = val
|
||||
case "directory-type":
|
||||
var fsType fs.FilesystemType
|
||||
fsType.UnmarshalText([]byte(val))
|
||||
cfg.Folders[i].FilesystemType = fsType
|
||||
case "type":
|
||||
var t config.FolderType
|
||||
if err := t.UnmarshalText([]byte(val)); err != nil {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
)
|
||||
|
||||
func nulString(bs []byte) string {
|
||||
@@ -33,7 +33,7 @@ func defaultConfigDir() string {
|
||||
return filepath.Join(os.Getenv("AppData"), "Syncthing")
|
||||
|
||||
case "darwin":
|
||||
dir, err := osutil.ExpandTilde("~/Library/Application Support/Syncthing")
|
||||
dir, err := fs.ExpandTilde("~/Library/Application Support/Syncthing")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -43,7 +43,7 @@ func defaultConfigDir() string {
|
||||
if xdgCfg := os.Getenv("XDG_CONFIG_HOME"); xdgCfg != "" {
|
||||
return filepath.Join(xdgCfg, "syncthing")
|
||||
}
|
||||
dir, err := osutil.ExpandTilde("~/.config/syncthing")
|
||||
dir, err := fs.ExpandTilde("~/.config/syncthing")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
<html lang="en" ng-app="syncthing" ng-controller="relayDataController">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
|
||||
<title>Relay stats</title>
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css"/>
|
||||
|
||||
<style>
|
||||
#map {
|
||||
@@ -36,9 +36,9 @@
|
||||
|
||||
<body class="ng-cloak">
|
||||
<div class="container">
|
||||
<h1>Relay Pool Data</h2>
|
||||
<h1>Relay Pool Data</h1>
|
||||
<div ng-if="relays === undefined" class="text-center">
|
||||
<img src="//cdnjs.cloudflare.com/ajax/libs/galleriffic/2.0.1/css/loader.gif"/>
|
||||
<img src="//cdnjs.cloudflare.com/ajax/libs/galleriffic/2.0.1/css/loader.gif" alt=""/>
|
||||
<p>Please wait while we gather data</p>
|
||||
</div>
|
||||
<div>
|
||||
@@ -184,10 +184,10 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
<script src="//maps.googleapis.com/maps/api/js"></script>
|
||||
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.4.min.js"></script>
|
||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script>
|
||||
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js"></script>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
@@ -395,12 +395,12 @@
|
||||
<span ng-if="relay.status.options['global-rate'] != undefined">
|
||||
<span ng-if="relay.status.options['global-rate'] > 0">Global rate limit: {{ relay.status.options['global-rate'] | bytes }}/s</span>
|
||||
<span ng-if="relay.status.options['global-rate'] == 0">Global rate limit: unlimited</span>
|
||||
</br>
|
||||
<br/>
|
||||
</span>
|
||||
<span ng-if="relay.status.options['per-session-rate'] != undefined">
|
||||
<span ng-if="relay.status.options['per-session-rate'] > 0">Session rate limit: {{ relay.status.options['per-session-rate'] | bytes }}/s</span>
|
||||
<span ng-if="relay.status.options['per-session-rate'] == 0">Session rate limit: unlimited</span>
|
||||
</br>
|
||||
<br/>
|
||||
</span>
|
||||
</div>
|
||||
<div ng-if="!relay.status">
|
||||
|
||||
@@ -59,6 +59,13 @@ func listener(proto, addr string, config *tls.Config) {
|
||||
|
||||
func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config) {
|
||||
conn := tls.Server(tcpConn, config)
|
||||
if err := conn.SetDeadline(time.Now().Add(messageTimeout)); err != nil {
|
||||
if debug {
|
||||
log.Println("Weird error setting deadline:", err, "on", conn.RemoteAddr())
|
||||
}
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
err := conn.Handshake()
|
||||
if err != nil {
|
||||
if debug {
|
||||
@@ -81,6 +88,7 @@ func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config) {
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
conn.SetDeadline(time.Time{})
|
||||
|
||||
id := syncthingprotocol.NewDeviceID(certs[0].Raw)
|
||||
|
||||
@@ -277,6 +285,7 @@ func sessionConnectionHandler(conn net.Conn) {
|
||||
if debug {
|
||||
log.Println("Weird error setting deadline:", err, "on", conn.RemoteAddr())
|
||||
}
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,16 @@ var rc *rateCalculator
|
||||
func statusService(addr string) {
|
||||
rc = newRateCalculator(360, 10*time.Second, &bytesProxied)
|
||||
|
||||
http.HandleFunc("/status", getStatus)
|
||||
if err := http.ListenAndServe(addr, nil); err != nil {
|
||||
handler := http.NewServeMux()
|
||||
handler.HandleFunc("/status", getStatus)
|
||||
|
||||
srv := http.Server{
|
||||
Addr: addr,
|
||||
Handler: handler,
|
||||
ReadTimeout: 15 * time.Second,
|
||||
}
|
||||
srv.SetKeepAlivesEnabled(false)
|
||||
if err := srv.ListenAndServe(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ import (
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
"github.com/syncthing/syncthing/lib/discover"
|
||||
"github.com/syncthing/syncthing/lib/events"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/logger"
|
||||
"github.com/syncthing/syncthing/lib/model"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/rand"
|
||||
"github.com/syncthing/syncthing/lib/stats"
|
||||
@@ -856,7 +856,7 @@ func (s *apiService) getSystemStatus(w http.ResponseWriter, r *http.Request) {
|
||||
var m runtime.MemStats
|
||||
runtime.ReadMemStats(&m)
|
||||
|
||||
tilde, _ := osutil.ExpandTilde("~")
|
||||
tilde, _ := fs.ExpandTilde("~")
|
||||
res := make(map[string]interface{})
|
||||
res["myID"] = myID.String()
|
||||
res["goroutines"] = runtime.NumGoroutine()
|
||||
@@ -1259,23 +1259,35 @@ func (s *apiService) getPeerCompletion(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *apiService) getSystemBrowse(w http.ResponseWriter, r *http.Request) {
|
||||
qs := r.URL.Query()
|
||||
current := qs.Get("current")
|
||||
// Default value or in case of error unmarshalling ends up being basic fs.
|
||||
var fsType fs.FilesystemType
|
||||
fsType.UnmarshalText([]byte(qs.Get("filesystem")))
|
||||
|
||||
if current == "" {
|
||||
if roots, err := osutil.GetFilesystemRoots(); err == nil {
|
||||
filesystem := fs.NewFilesystem(fsType, "")
|
||||
if roots, err := filesystem.Roots(); err == nil {
|
||||
sendJSON(w, roots)
|
||||
} else {
|
||||
http.Error(w, err.Error(), 500)
|
||||
}
|
||||
return
|
||||
}
|
||||
search, _ := osutil.ExpandTilde(current)
|
||||
pathSeparator := string(os.PathSeparator)
|
||||
search, _ := fs.ExpandTilde(current)
|
||||
pathSeparator := string(fs.PathSeparator)
|
||||
|
||||
if strings.HasSuffix(current, pathSeparator) && !strings.HasSuffix(search, pathSeparator) {
|
||||
search = search + pathSeparator
|
||||
}
|
||||
subdirectories, _ := osutil.Glob(search + "*")
|
||||
searchDir := filepath.Dir(search)
|
||||
searchFile := filepath.Base(search)
|
||||
|
||||
fs := fs.NewFilesystem(fsType, searchDir)
|
||||
|
||||
subdirectories, _ := fs.Glob(searchFile + "*")
|
||||
|
||||
ret := make([]string, 0, len(subdirectories))
|
||||
for _, subdirectory := range subdirectories {
|
||||
info, err := os.Stat(subdirectory)
|
||||
info, err := fs.Stat(subdirectory)
|
||||
if err == nil && info.IsDir() {
|
||||
ret = append(ret, subdirectory+pathSeparator)
|
||||
}
|
||||
|
||||
@@ -943,7 +943,7 @@ func TestEventMasks(t *testing.T) {
|
||||
}
|
||||
|
||||
expected = 0
|
||||
if mask := svc.getEventMask("WeirdEvent,something else that doens't exist"); mask != expected {
|
||||
if mask := svc.getEventMask("WeirdEvent,something else that doesn't exist"); mask != expected {
|
||||
t.Errorf("incorrect parsed mask %x != %x", int64(mask), int64(expected))
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
)
|
||||
|
||||
type locationEnum string
|
||||
@@ -65,7 +65,7 @@ func expandLocations() error {
|
||||
dir = strings.Replace(dir, "${"+varName+"}", value, -1)
|
||||
}
|
||||
var err error
|
||||
dir, err = osutil.ExpandTilde(dir)
|
||||
dir, err = fs.ExpandTilde(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func defaultConfigDir() string {
|
||||
return filepath.Join(os.Getenv("AppData"), "Syncthing")
|
||||
|
||||
case "darwin":
|
||||
dir, err := osutil.ExpandTilde("~/Library/Application Support/Syncthing")
|
||||
dir, err := fs.ExpandTilde("~/Library/Application Support/Syncthing")
|
||||
if err != nil {
|
||||
l.Fatalln(err)
|
||||
}
|
||||
@@ -96,7 +96,7 @@ func defaultConfigDir() string {
|
||||
if xdgCfg := os.Getenv("XDG_CONFIG_HOME"); xdgCfg != "" {
|
||||
return filepath.Join(xdgCfg, "syncthing")
|
||||
}
|
||||
dir, err := osutil.ExpandTilde("~/.config/syncthing")
|
||||
dir, err := fs.ExpandTilde("~/.config/syncthing")
|
||||
if err != nil {
|
||||
l.Fatalln(err)
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func defaultConfigDir() string {
|
||||
|
||||
// homeDir returns the user's home directory, or dies trying.
|
||||
func homeDir() string {
|
||||
home, err := osutil.ExpandTilde("~")
|
||||
home, err := fs.ExpandTilde("~")
|
||||
if err != nil {
|
||||
l.Fatalln(err)
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import (
|
||||
"github.com/syncthing/syncthing/lib/dialer"
|
||||
"github.com/syncthing/syncthing/lib/discover"
|
||||
"github.com/syncthing/syncthing/lib/events"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/logger"
|
||||
"github.com/syncthing/syncthing/lib/model"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
@@ -444,7 +445,7 @@ func openGUI() {
|
||||
}
|
||||
|
||||
func generate(generateDir string) {
|
||||
dir, err := osutil.ExpandTilde(generateDir)
|
||||
dir, err := fs.ExpandTilde(generateDir)
|
||||
if err != nil {
|
||||
l.Fatalln("generate:", err)
|
||||
}
|
||||
@@ -1074,7 +1075,7 @@ func setupGUI(mainService *suture.Supervisor, cfg *config.Wrapper, m *model.Mode
|
||||
|
||||
if cfg.Options().StartBrowser && !runtimeOptions.noBrowser && !runtimeOptions.stRestarting {
|
||||
// Can potentially block if the utility we are invoking doesn't
|
||||
// fork, and just execs, hence keep it in it's own routine.
|
||||
// fork, and just execs, hence keep it in its own routine.
|
||||
<-api.startedOnce
|
||||
go openURL(guiCfg.URL())
|
||||
}
|
||||
@@ -1085,7 +1086,7 @@ func defaultConfig(myName string) config.Configuration {
|
||||
|
||||
if !noDefaultFolder {
|
||||
l.Infoln("Default folder created and/or linked to new config")
|
||||
defaultFolder = config.NewFolderConfiguration("default", locations[locDefFolder])
|
||||
defaultFolder = config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, locations[locDefFolder])
|
||||
defaultFolder.Label = "Default Folder"
|
||||
defaultFolder.RescanIntervalS = 60
|
||||
defaultFolder.MinDiskFree = config.Size{Value: 1, Unit: "%"}
|
||||
@@ -1141,19 +1142,20 @@ func shutdown() {
|
||||
stop <- exitSuccess
|
||||
}
|
||||
|
||||
func ensureDir(dir string, mode os.FileMode) {
|
||||
err := osutil.MkdirAll(dir, mode)
|
||||
func ensureDir(dir string, mode fs.FileMode) {
|
||||
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, dir)
|
||||
err := fs.MkdirAll(".", mode)
|
||||
if err != nil {
|
||||
l.Fatalln(err)
|
||||
}
|
||||
|
||||
if fi, err := os.Stat(dir); err == nil {
|
||||
if fi, err := fs.Stat("."); err == nil {
|
||||
// Apprently the stat may fail even though the mkdirall passed. If it
|
||||
// does, we'll just assume things are in order and let other things
|
||||
// fail (like loading or creating the config...).
|
||||
currentMode := fi.Mode() & 0777
|
||||
if currentMode != mode {
|
||||
err := os.Chmod(dir, mode)
|
||||
err := fs.Chmod(".", mode)
|
||||
// This can fail on crappy filesystems, nothing we can do about it.
|
||||
if err != nil {
|
||||
l.Warnln(err)
|
||||
@@ -1276,22 +1278,22 @@ func cleanConfigDirectory() {
|
||||
}
|
||||
|
||||
for pat, dur := range patterns {
|
||||
pat = filepath.Join(baseDirs["config"], pat)
|
||||
files, err := osutil.Glob(pat)
|
||||
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, baseDirs["config"])
|
||||
files, err := fs.Glob(pat)
|
||||
if err != nil {
|
||||
l.Infoln("Cleaning:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
info, err := osutil.Lstat(file)
|
||||
info, err := fs.Lstat(file)
|
||||
if err != nil {
|
||||
l.Infoln("Cleaning:", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if time.Since(info.ModTime()) > dur {
|
||||
if err = os.RemoveAll(file); err != nil {
|
||||
if err = fs.RemoveAll(file); err != nil {
|
||||
l.Infoln("Cleaning:", err)
|
||||
} else {
|
||||
l.Infoln("Cleaned away old file", filepath.Base(file))
|
||||
|
||||
@@ -5,7 +5,7 @@ the "Upstart" service manager on Linux. To have syncthing start when you login
|
||||
place "user/syncthing.conf" in the "/home/[username]/.config/upstart/" folder.
|
||||
To have syncthing start when the system boots place "system/syncthing.conf"
|
||||
in the "/etc/init/" folder.
|
||||
To manualy start syncthing via Upstart when using the system configuration use:
|
||||
To manually start syncthing via Upstart when using the system configuration use:
|
||||
|
||||
```
|
||||
sudo initctl start syncthing
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Когато добавяш ново устройство помни, че твоето устройство също трябва да бъде добавено от другата страна.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Когато добавяш нов идентификатор на папка помни, че той се използва за свързване на папките на различни устройства. Главни/малки букви са от значение и трябва да са еднакви на всички устройства.",
|
||||
"Yes": "Да",
|
||||
"You can also select one of these nearby devices:": "Също така може да изберете едно от следните устройтва намиращи се наблизо:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Може да промените решението си по всяко време в прозореца Настройки.",
|
||||
"You can read more about the two release channels at the link below.": "Може да научите допълнително за двата канала на версии, следвайки връзката по-долу.",
|
||||
"You must keep at least one version.": "Трябва да пазиш поне една версия.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Quant s'afig un nou dispositiu, hi ha que tindre en compte que aquest dispositiu deu ser afegit també en l'altre costat.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Quant s'afig una nova carpeta, hi ha que tindre en compte que l'ID de la carpeta s'utilitza per a juntar les carpetes entre dispositius. Són sensibles a les majúscules i deuen coincidir exactament entre tots els dispositius.",
|
||||
"Yes": "Sí",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Pots canviar la teua elecció en qualsevol moment en el dialog Ajustos",
|
||||
"You can read more about the two release channels at the link below.": "Pots llegir més sobre els dos canals de versions en l'enllaç de baix.",
|
||||
"You must keep at least one version.": "Es deu mantindre al menys una versió.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Při přidávání nového přístroje mějte na paměti, že je ho třeba také zadat na druhé straně.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Při přidávání nového adresáře mějte na paměti, že jeho ID je použito ke svázání adresářů napříč přístoji. Rozlišují se malá a velká písmena a musí přesně souhlasit mezi všemi přístroji.",
|
||||
"Yes": "Ano",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Vaši volbu můžete kdykoliv změnit v dialogu nastavení.",
|
||||
"You can read more about the two release channels at the link below.": "O kandidátech na vydání si můžete přečíst více v odkazu níže.",
|
||||
"You must keep at least one version.": "Je třeba ponechat alespoň jednu verzi.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Når der tilføjes en ny enhed, vær da opmærksom på, at denne enhed også skal tilføjes på den anden side.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Når der tilføjes en ny enhed, vær da opmærksom på at samme ID bruges til at forbinde mapperne på de forskellige enheder. Der er forskel på store og små bogstaver, og ID skal være fuldstændig identisk på alle enheder.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Du kan altid ændre dit valg under indstillinger.",
|
||||
"You can read more about the two release channels at the link below.": "Du kan læse mere om de to udgivelseskanaler på links herunder.",
|
||||
"You must keep at least one version.": "Du skal beholde mindst én version.",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"Add Device": "Gerät hinzufügen",
|
||||
"Add Folder": "Ordner hinzufügen",
|
||||
"Add Remote Device": "Gerät hinzufügen",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "Add devices from the introducer to our device list, for mutually shared folders.",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "Fügt Geräte vom Verteilergerät zu der eigenen Geräteliste hinzu, um gegenseitig geteilte Ordner zu ermöglichen.",
|
||||
"Add new folder?": "Neuen Ordner hinzufügen?",
|
||||
"Address": "Adresse",
|
||||
"Addresses": "Adressen",
|
||||
@@ -21,10 +21,10 @@
|
||||
"Allow Anonymous Usage Reporting?": "Übertragung von anonymen Nutzungsberichten erlauben?",
|
||||
"Allowed Networks": "Erlaubte Netzwerke",
|
||||
"Alphabetic": "Alphabetisch",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "Ein externer Befehl führt die Versionierung durch. Dazu muss die Datei aus dem geteilten Ordner entfernt werden.",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "Ein externer Befehl führt die Versionierung durch. Er muss die Datei aus dem geteilten Ordner entfernen.",
|
||||
"An external command handles the versioning. It has to remove the file from the synced folder.": "Ein externer Programmaufruf handhabt die Versionierung. Es muss die Datei aus dem zu synchronisierendem Ordner entfernen.",
|
||||
"Anonymous Usage Reporting": "Anonymer Nutzungsbericht",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "Alle Geräte, die beim Verteiler eingetragen sind, werden auch bei diesem Gerät eingetragen",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "Alle Geräte, die beim Verteilergerät eingetragen sind, werden auch bei diesem Gerät hinzugefügt.",
|
||||
"Automatic upgrade now offers the choice between stable releases and release candidates.": "Die automatische Aktualisierung bietet jetzt die Wahl zwischen stabilen Veröffentlichungen und Veröffentlichungskandidaten.",
|
||||
"Automatic upgrades": "Automatische Updates aktivieren",
|
||||
"Be careful!": "Vorsicht!",
|
||||
@@ -32,7 +32,7 @@
|
||||
"CPU Utilization": "Prozessorauslastung",
|
||||
"Changelog": "Änderungsprotokoll",
|
||||
"Clean out after": "Löschen nach",
|
||||
"Click to see discovery failures": "Zum Anzeigen von Gerätesuchfehlern klicken",
|
||||
"Click to see discovery failures": "Klick um Gerätesuchfehler anzuzeigen",
|
||||
"Close": "Schließen",
|
||||
"Command": "Befehl",
|
||||
"Comment, when used at the start of a line": "Kommentar, wenn am Anfang der Zeile benutzt.",
|
||||
@@ -44,7 +44,7 @@
|
||||
"Copied from original": "Vom Original kopiert",
|
||||
"Copyright © 2014-2016 the following Contributors:": "Copyright © 2014-2016 der folgenden Unterstützer:",
|
||||
"Copyright © 2014-2017 the following Contributors:": "Copyright © 2014-2017 der folgenden Unterstützer:",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "Creating ignore patterns, overwriting an existing file at {{path}}.",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "Erstelle Ignoriermuster, welche die existierende Datei {{path}} überschreiben.",
|
||||
"Danger!": "Achtung!",
|
||||
"Deleted": "Gelöscht",
|
||||
"Device": "Gerät",
|
||||
@@ -65,24 +65,24 @@
|
||||
"Edit Device": "Gerät bearbeiten",
|
||||
"Edit Folder": "Ordner bearbeiten",
|
||||
"Editing": "Bearbeitet",
|
||||
"Editing {%path%}.": "{{path}} wird bearbeitet.",
|
||||
"Editing {%path%}.": "Bearbeite {{path}}.",
|
||||
"Enable NAT traversal": "NAT-Durchdringung aktivieren",
|
||||
"Enable Relaying": "Weiterleitung aktivieren",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Enter a non-privileged port number (1024 - 65535).",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Geben Sie eine positive Zahl ein (z.B. \"2.35\") und wählen Sie eine Einheit. Prozentsätze sind Teil der gesamten Festplattengröße.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Geben Sie eine nichtprivilegierte Portnummer ein (1024 - 65535).",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Kommagetrennte Adressen (\"tcp://ip:port\", \"tcp://host:port\") oder \"dynamic\" eingeben, um die Adresse automatisch zu ermitteln.",
|
||||
"Enter ignore patterns, one per line.": "Geben Sie Ignoriermuster ein, eines pro Zeile.",
|
||||
"Error": "Fehler",
|
||||
"External File Versioning": "Externe Dateiversionierung",
|
||||
"Failed Items": "Fehlgeschlagene Objekte",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Es wird ein Verbindungsfehler zu IPv6-Servern erwartet, wenn es keine IPv6-Konnektivität gibt.",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Ein Verbindungsfehler zu IPv6-Servern ist zu erwarten, wenn es keine IPv6-Konnektivität gibt.",
|
||||
"File Pull Order": "Dateiübertragungsreihenfolge",
|
||||
"File Versioning": "Dateiversionierung",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "Dateizugriffsrechte beim Suchen nach Veränderungen ignorieren. Bei FAT-Dateisystemen zu verwenden.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Dateien werden in das .stversions-Verzeichnis verschoben, wenn sie von Syncthing ersetzt oder gelöscht werden.",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Wenn Syncthing Dateien ersetzt oder löscht, werden sie in den Ordner .stversions verschoben.",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Dateien werden mit einem Datumsstempel im Namen versehen und in ein .stversions-Verzeichnis verschoben, wenn sie von Syncthing ersetzt oder gelöscht werden.",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Dateien werden, bevor Syncthing sie löscht oder ersetzt, datiert in den Ordner .stversions verschoben.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Dateien werden in den .stversions Ordner verschoben, wenn sie von Syncthing ersetzt oder gelöscht werden.",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Dateien werden in den .stversions Ordner verschoben, wenn sie von Syncthing ersetzt oder gelöscht werden.",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Dateien werden mit Datumsstempel versioniert und in den .stversions Ordner verschoben, wenn sie von Syncthing ersetzt oder gelöscht werden.",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Dateien werden mit Datumsstempel versioniert und in den .stversions Ordner verschoben, wenn sie von Syncthing ersetzt oder gelöscht werden.",
|
||||
"Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.": "Dateien sind auf diesem Gerät schreibgeschützt. Auf diesem Gerät durchgeführte Veränderungen werden aber auf den Rest des Verbunds übertragen.",
|
||||
"Folder": "Ordner",
|
||||
"Folder ID": "Ordnerkennung",
|
||||
@@ -93,9 +93,9 @@
|
||||
"GUI": "GUI",
|
||||
"GUI Authentication Password": "Passwort für Zugang zur Benutzeroberfläche",
|
||||
"GUI Authentication User": "Nutzername für Zugang zur Benutzeroberfläche",
|
||||
"GUI Listen Address": "GUI Listen Address",
|
||||
"GUI Listen Addresses": "Adresse(n) für die Benutzeroberfläche",
|
||||
"GUI Theme": "GUI-Theme",
|
||||
"GUI Listen Address": "Addresse der Benutzeroberfläche",
|
||||
"GUI Listen Addresses": "Adressen der Benutzeroberfläche",
|
||||
"GUI Theme": "GUI Design",
|
||||
"Generate": "Generieren",
|
||||
"Global Changes": "Globale Änderungen",
|
||||
"Global Discovery": "Globale Gerätesuche",
|
||||
@@ -123,7 +123,7 @@
|
||||
"Local Discovery": "Lokale Gerätesuche",
|
||||
"Local State": "Lokaler Status",
|
||||
"Local State (Total)": "Lokaler Status (Gesamt)",
|
||||
"Major Upgrade": "Hauptversionsupgrade",
|
||||
"Major Upgrade": "Hauptversionsupdate",
|
||||
"Master": "Master",
|
||||
"Maximum Age": "Höchstalter",
|
||||
"Metadata Only": "Nur Metadaten",
|
||||
@@ -136,7 +136,7 @@
|
||||
"Newest First": "Neueste zuerst",
|
||||
"No": "Nein",
|
||||
"No File Versioning": "Keine Dateiversionierung",
|
||||
"No upgrades": "Keine Upgrades",
|
||||
"No upgrades": "Keine Updates",
|
||||
"Normal": "Normal",
|
||||
"Notice": "Hinweis",
|
||||
"OK": "OK",
|
||||
@@ -150,16 +150,16 @@
|
||||
"Override Changes": "Änderungen überschreiben",
|
||||
"Path": "Pfad",
|
||||
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Pfad zum Ordner auf dem lokalen Gerät. Ordner wird erzeugt, wenn er nicht existiert. Das Tilden-Zeichen (~) kann als Abkürzung benutzt werden für",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "Pfad, in dem Versionen gespeichert werden sollen (leer lassen, wenn das Standard-.stversions-Verzeichnis im geteilten Ordner verwendet werden soll).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "Pfad in dem alte Dateiversionen gespeichert werden sollen (ohne Angabe wird der Ordner .stversions im Ordner verwendet).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "Pfad in dem Versionen gespeichert werden sollen (leer lassen, wenn der Standard .stversions Ordner für den geteilten Ordner verwendet werden soll).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "Pfad in dem Versionen gespeichert werden sollen (leer lassen, wenn der Standard .stversions Ordner für den geteilten Ordner verwendet werden soll).",
|
||||
"Pause": "Pause",
|
||||
"Pause All": "Alles pausieren",
|
||||
"Paused": "Pausiert",
|
||||
"Please consult the release notes before performing a major upgrade.": "Bitte lesen Sie die Veröffentlichungsnotizen bevor Sie eine neue Hauptversion installieren.",
|
||||
"Please consult the release notes before performing a major upgrade.": "Bitte lesen Sie die Veröffentlichungsnotizen bevor Sie ein neues Hauptversionsupdate installieren.",
|
||||
"Please set a GUI Authentication User and Password in the Settings dialog.": "Bitte setze einen Benutzer und ein Passwort für das GUI in den Einstellungen.",
|
||||
"Please wait": "Bitte warten",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Prefix indicating that the file can be deleted if preventing directory removal",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Prefix indicating that the pattern should be matched without case sensitivity",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Präfix, das anzeigt, dass die Datei gelöscht werden kann, wenn sie die Entfernung des Ordners verhindert",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Präfix, das anzeigt, dass das Muster ohne Beachtung der Groß-/Kleinschreibung übereinstimmen soll",
|
||||
"Preview": "Vorschau",
|
||||
"Preview Usage Report": "Vorschau des Nutzungsberichts",
|
||||
"Quick guide to supported patterns": "Schnellanleitung zu den unterstützten Mustern",
|
||||
@@ -167,7 +167,7 @@
|
||||
"Random": "Zufall",
|
||||
"Reduced by ignore patterns": "Durch Ignoriermuster reduziert",
|
||||
"Release Notes": "Veröffentlichungsnotizen",
|
||||
"Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Veröffentlichungskandidaten enthalten die neuesten Funktionen und Verbesserungen. Sie ähneln den traditionellen zweiwöchentlichen Syncthing-Veröffentlichungen.",
|
||||
"Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Veröffentlichungskandidaten enthalten die neuesten Funktionen und Verbesserungen. Sie gleichen den üblichen zweiwöchentlichen Syncthing-Veröffentlichungen.",
|
||||
"Remote Devices": "Fern-Geräte",
|
||||
"Remove": "Entfernen",
|
||||
"Required identifier for the folder. Must be the same on all cluster devices.": "Erforderlicher Bezeichner für den Ordner. Muss auf allen Verbund-Geräten gleich sein.",
|
||||
@@ -205,8 +205,8 @@
|
||||
"Smallest First": "Kleinstes zuerst",
|
||||
"Source Code": "Quellcode",
|
||||
"Stable releases and release candidates": "Stabile Veröffentlichungen und Veröffentlichungskandidaten",
|
||||
"Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "Stabile Veröffentlichungen werden ca. 2 Wochen zurückgehalten. Während dieser Zeit durchlaufen sie eine Testphase als Veröffentlichungskandidaten.",
|
||||
"Stable releases only": "Ausschließlich stabile Veröffentlichungen",
|
||||
"Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "Stabile Veröffentlichungen werden ca. 2 Wochen verzögert. Während dieser Zeit durchlaufen sie eine Testphase als Veröffentlichungskandidaten.",
|
||||
"Stable releases only": "Nur stabile Veröffentlichungen",
|
||||
"Staggered File Versioning": "Stufenweise Dateiversionierung",
|
||||
"Start Browser": "Browser starten",
|
||||
"Statistics": "Statistiken",
|
||||
@@ -246,8 +246,8 @@
|
||||
"They are retried automatically and will be synced when the error is resolved.": "Sie werden automatisch heruntergeladen und werden synchronisiert, wenn der Fehler behoben wurde.",
|
||||
"This Device": "Dieses Gerät",
|
||||
"This can easily give hackers access to read and change any files on your computer.": "Dies kann dazu führen, dass Unberechtigte relativ einfach auf Ihre Dateien zugreifen und diese ändern können.",
|
||||
"This is a major version upgrade.": "Dies ist eine neue Hauptversion.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "This setting controls the free space required on the home (i.e., index database) disk.",
|
||||
"This is a major version upgrade.": "Dies ist ein neues Hauptversionsupdate.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "Diese Einstellung regelt den freien Speicherplatz, der für den Systemordner (d.h. Indexdatenbank) erforderlich ist.",
|
||||
"Time": "Zeit",
|
||||
"Trash Can File Versioning": "Papierkorb Dateiversionierung",
|
||||
"Type": "Typ",
|
||||
@@ -256,12 +256,12 @@
|
||||
"Unused": "Ungenutzt",
|
||||
"Up to Date": "Aktuell",
|
||||
"Updated": "Aktualisiert",
|
||||
"Upgrade": "Upgrade",
|
||||
"Upgrade": "Update",
|
||||
"Upgrade To {%version%}": "Update auf {{version}}",
|
||||
"Upgrading": "Wird aktualisiert",
|
||||
"Upload Rate": "Upload",
|
||||
"Uptime": "Betriebszeit",
|
||||
"Usage reporting is always enabled for candidate releases.": "Nutzungsauswertung ist für Veröffentlichungskandidaten immer aktiviert.",
|
||||
"Usage reporting is always enabled for candidate releases.": "Nutzungsbericht ist für Veröffentlichungskandidaten immer aktiviert.",
|
||||
"Use HTTPS for GUI": "HTTPS für Benutzeroberfläche benutzen",
|
||||
"Version": "Version",
|
||||
"Versions Path": "Versionierungspfad",
|
||||
@@ -273,8 +273,9 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Beachte beim Hinzufügen eines neuen Gerätes, dass dieses Gerät auch auf den anderen Geräten hinzugefügt werden muss.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Beachte bitte beim Hinzufügen eines neuen Ordners, dass die Ordnerkennung dazu verwendet wird, Ordner zwischen Geräten zu verbinden. Die Kennung muss also auf allen Geräten gleich sein, die Groß- und Kleinschreibung muss dabei beachtet werden.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "Sie können auch ein in der Nähe befindliches Geräte auswählen:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Sie können Ihre Wahl jederzeit in den Einstellungen ändern.",
|
||||
"You can read more about the two release channels at the link below.": "Über den untenstehenden Link können Sie mehr über die zwei Veröffentlichungskanäle erfahren.",
|
||||
"You can read more about the two release channels at the link below.": "Über den folgenden Link können Sie mehr über die zwei Veröffentlichungskanäle erfahren.",
|
||||
"You must keep at least one version.": "Du musst mindestens eine Version behalten.",
|
||||
"days": "Tage",
|
||||
"directories": "Ordner",
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
"Failed Items": "Αρχεία που απέτυχαν",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Είναι φυσιολογική η αποτυχία σύνδεσης σε εξυπηρετητές IPv6 όταν δεν υπάρχει συνδεσιμότητα IPv6.",
|
||||
"File Pull Order": "Σειρά με την οποία θα κατεβαίνουν τα αρχεία",
|
||||
"File Versioning": "Τήρηση εκδόσεων",
|
||||
"File Versioning": "Τήρηση εκδόσεων αρχείων",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "Τα δικαιώματα των αρχείων θα αγνοούνται όταν κοιτάζω για αλλαγές. Αφορά συστήματα αρχείων FAT.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Τα αρχεία που σβήνονται ή αντικαθίστανται από το Syncthing μετακινούνται στον κατάλογο .stversions.",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Τα αρχεία που σβήνονται ή αντικαθιστούνται από το Syncthing μετακινούνται σε έναν φάκελο .stversions με χρονοσφραγίδα.",
|
||||
@@ -159,7 +159,7 @@
|
||||
"Please set a GUI Authentication User and Password in the Settings dialog.": "Παρακαλώ όρισε στις ρυθμίσεις έναν χρήστη και έναν κωδικό πρόσβασης για τη διεπαφή.",
|
||||
"Please wait": "Παρακαλώ περιμένετε",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Πρόθεμα που δείχνει ότι το αρχείο θα μπορεί να διαγραφεί αν εμποδίζει τη διαγραφή καταλόγου",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Πρόθεμα που δείχνει ότι αντιστοίχιση του προτύπου θα γίνεται χωρίς διάκριση πεζών και κεφαλαίων χαρακτήρων",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Πρόθεμα που δείχνει ότι η αντιστοίχιση προτύπου θα γίνεται χωρίς διάκριση πεζών και κεφαλαίων χαρακτήρων",
|
||||
"Preview": "Προεπισκόπηση",
|
||||
"Preview Usage Report": "Προεπισκόπηση αναφοράς χρήσης",
|
||||
"Quick guide to supported patterns": "Σύντομη βοήθεια σχετικά με τα πρότυπα αναζήτησης που υποστηρίζονται",
|
||||
@@ -237,7 +237,7 @@
|
||||
"The maximum time to keep a version (in days, set to 0 to keep versions forever).": "Η μέγιστη ηλικία παλιότερων εκδόσεων (σε ημέρες, αν δώσεις 0 οι παλιότερες εκδόσεις θα διατηρούνται για πάντα).",
|
||||
"The minimum free disk space percentage must be a non-negative number between 0 and 100 (inclusive).": "Το ποσοστό του ελάχιστου διαθέσιμου αποθηκευτικόυ χώρου πρέπει να είναι έναν μη-αρνητικός αριθμός μεταξύ του 0 και του 100 (συμπεριλαμβανομένων)",
|
||||
"The number of days must be a number and cannot be blank.": "Ο αριθμός ημερών πρέπει να είναι αριθμός και σίγουρα όχι κενό.",
|
||||
"The number of days to keep files in the trash can. Zero means forever.": "Ο αριθμός ημερών που θα διατηρούντα τα αρχεία στον κάδο. Μηδέν σημαίνει διατήρηση για πάντα.",
|
||||
"The number of days to keep files in the trash can. Zero means forever.": "Ο αριθμός ημερών που θα διατηρούνται τα αρχεία στον κάδο. Μηδέν σημαίνει διατήρηση για πάντα.",
|
||||
"The number of old versions to keep, per file.": "Πόσες παλιότερες εκδόσεις θα διατηρούνται, ανά αρχείο.",
|
||||
"The number of versions must be a number and cannot be blank.": "Ο αριθμός εκδόσεων πρέπει να είναι αριθμός και σίγουρα όχι κενό.",
|
||||
"The path cannot be blank.": "Το μονοπάτι δεν μπορεί να είναι κενό.",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Θυμήσου πως όταν προσθέτεις μια νέα συσκευή, ετούτη η συσκευή θα πρέπει να προστεθεί και στην άλλη πλευρά.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Όταν προσθέτεις έναν νέο φάκελο, θυμήσου πως η ταυτότητα ενός φακέλου χρησιμοποιείται για να να συσχετίσει φακέλους μεταξύ συσκευών. Η ταυτότητα του φακέλου θα πρέπει να είναι η ίδια σε όλες τις συσκευές και έχουν σημασία τα πεζά ή κεφαλαία γράμματα.",
|
||||
"Yes": "Ναι",
|
||||
"You can also select one of these nearby devices:": "Μπορείτε επίσης να επιλέξετε μια από αυτές τις γειτονικές συσκευές:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Μπορείτε να αλλάξετε τη ρύθμιση αυτή ανά πάσα στιγμή στο παράθυρο «Ρυθμίσεις».",
|
||||
"You can read more about the two release channels at the link below.": "Μπορείτε να διαβάσετε περισσότερα για τα δύο κανάλια εκδόσεων στον παρακάτω σύνδεσμο.",
|
||||
"You must keep at least one version.": "Πρέπει να τηρήσεις τουλάχιστον μια έκδοση.",
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
"Random": "Random",
|
||||
"Reduced by ignore patterns": "Reduced by ignore patterns",
|
||||
"Release Notes": "Release Notes",
|
||||
"Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.",
|
||||
"Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Release candidates contain the latest features and fixes. They are similar to the traditional fortnightly Syncthing releases.",
|
||||
"Remote Devices": "Remote Devices",
|
||||
"Remove": "Remove",
|
||||
"Required identifier for the folder. Must be the same on all cluster devices.": "Required identifier for the folder. Must be the same on all cluster devices.",
|
||||
@@ -273,7 +273,8 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.",
|
||||
"Yes": "Yes",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialogue.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You must keep at least one version.": "You must keep at least one version.",
|
||||
"days": "days",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.",
|
||||
"Yes": "Yes",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You must keep at least one version.": "You must keep at least one version.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Dum la aldonado de nova aparato, memoru ke ĉi tiu aparato devas esti aldonita en la alia flanko ankaŭ.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Dum la aldonado de nova dosierujo, memoru ke la Dosieruja ID estas uzita por ligi la dosierujojn kune inter aparatoj. Ili estas literfakodistingaj kaj devas kongrui precize inter ĉiuj aparatoj.",
|
||||
"Yes": "Jes",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Vi povas ŝanĝi vian elekton iam ajn en la Agorda dialogo.",
|
||||
"You can read more about the two release channels at the link below.": "Vi povas legi plu pri la du eldonkanaloj per la malsupra ligilo.",
|
||||
"You must keep at least one version.": "Vi devas konservi almenaŭ unu version.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Cuando añada un nuevo dispositivo, tenga en cuenta que este debe añadirse también en el otro lado.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Cuando añada una nueva carpeta, tenga en cuenta que su ID se usa para unir carpetas entre dispositivos. Son sensibles a las mayúsculas y deben coincidir exactamente entre todos los dispositivos.",
|
||||
"Yes": "Si",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Puedes cambiar tu elección en cualquier momento en el panel de Ajustes.",
|
||||
"You can read more about the two release channels at the link below.": "Puedes leer más sobre los dos método de publicación de versiones en el siguiente enlace.",
|
||||
"You must keep at least one version.": "Debes mantener al menos una versión.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Cuando añada un nuevo dispositivo, tenga en cuenta que este debe añadirse también en el otro lado.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Cuando añada una nueva carpeta, tenga en cuenta que su ID se usa para unir carpetas entre dispositivos. Son sensibles a las mayúsculas y deben coincidir exactamente entre todos los dispositivos.",
|
||||
"Yes": "Si",
|
||||
"You can also select one of these nearby devices:": "También puede seleccionar uno de estos dispositivos cercanos:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Puedes cambiar tu elección en cualquier momento en el panel de Ajustes.",
|
||||
"You can read more about the two release channels at the link below.": "Puedes leer más sobre los dos método de publicación de versiones en el siguiente enlace.",
|
||||
"You must keep at least one version.": "Debes mantener al menos una versión.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Tresna bat gehitzen duzularik, gogoan atxik ezazu zurea bestaldean gehitu behar dela ere",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Partekatze bat gehitzen delarik, gogoan atxik ezazu bere IDa erabilia dela errepertorioak lotzeko tresnen bitartez. ID-a hautskorra da eta partekatze hontan parte hartzen duten tresna guzietan berdina izan behar du.",
|
||||
"Yes": "Bai",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Zure hautua aldatzen ahal duzu \"Konfigurazio\" leihatilan",
|
||||
"You can read more about the two release channels at the link below.": "Bi banaketa kanal hauen bidez gehiago jakin dezakezu, lokarri honen bidez ",
|
||||
"You must keep at least one version.": "Bertsio bat bederen behar duzu atxiki",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Lisättäessä laitetta, muista että tämä laite tulee myös lisätä toiseen laitteeseen.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Lisättäessä uutta kansiota, muista että kansion ID:tä käytetään solmimaan kansiot yhteen laitteiden välillä. Ne ovat riippuvaisia kirjankoosta ja niiden tulee täsmätä kaikkien laitteiden välillä.",
|
||||
"Yes": "Kyllä",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You must keep at least one version.": "Sinun tulee säilyttää ainakin yksi versio.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Lorsque vous ajoutez un appareil, gardez à l'esprit que le votre doit aussi être ajouté de l'autre coté.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Lorsqu'un nouveau partage est ajouté, gardez à l'esprit que son ID est utilisée pour lier les répertoires à travers les appareils. L'ID est sensible à la casse et sera forcément la même sur tous les appareils participant à ce partage.",
|
||||
"Yes": "Oui",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Vous pouvez changer votre choix dans la boîte de dialogue \"Configuration\".",
|
||||
"You can read more about the two release channels at the link below.": "Vous pouvez en savoir plus sur les deux canaux de distribution via le lien ci-dessous.",
|
||||
"You must keep at least one version.": "Vous devez garder au minimum une version.",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"A device with that ID is already added.": "L'appareil portant cette ID est déjà présent.",
|
||||
"A device with that ID is already added.": " L'appareil portant cet ID est déjà présent.",
|
||||
"A negative number of days doesn't make sense.": "Ce champ n'accepte qu'un entier positif ou nul.",
|
||||
"A new major version may not be compatible with previous versions.": "Une nouvelle version majeure peut présenter des incompatibilités avec les versions antérieures.",
|
||||
"API Key": "Clé API",
|
||||
@@ -48,7 +48,7 @@
|
||||
"Danger!": "Attention !",
|
||||
"Deleted": "Supprimé",
|
||||
"Device": "Appareil",
|
||||
"Device \"{%name%}\" ({%device%} at {%address%}) wants to connect. Add new device?": "L'appareil \"{{name}}\" ({{device}} à {{address}}) veut se connecter. L'acceptez-vous ?",
|
||||
"Device \"{%name%}\" ({%device%} at {%address%}) wants to connect. Add new device?": "\"{{name}}\" ({{device}}), appareil actuellement à {{address}}, demande à se connecter.\nAcceptez-vous de l'ajouter à votre liste d'appareils connus ?",
|
||||
"Device ID": "ID de l'appareil",
|
||||
"Device Identification": "Identifiant de l'appareil",
|
||||
"Device Name": "Nom de l'appareil",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Lorsque vous ajoutez un appareil, gardez à l'esprit que le votre doit aussi être ajouté de l'autre coté.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Lorsqu'un nouveau partage est ajouté, gardez à l'esprit que son ID est utilisée pour lier les répertoires à travers les appareils. L'ID est sensible à la casse et sera forcément la même sur tous les appareils participant à ce partage.",
|
||||
"Yes": "Oui",
|
||||
"You can also select one of these nearby devices:": "Vous pouvez également sélectionner l'un de ces appareils proches :",
|
||||
"You can change your choice at any time in the Settings dialog.": "Vous pouvez changer votre choix dans la boîte de dialogue \"Configuration\".",
|
||||
"You can read more about the two release channels at the link below.": "Vous pouvez en savoir plus sur les deux canaux de distribution via le lien ci-dessous.",
|
||||
"You must keep at least one version.": "Vous devez garder au minimum une version.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Hâld by it taheakjen fan in nij apparaat yn de holle dat it apparaat oan de oare kant ek taheakke wurde moat. ",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Hâld by it taheakjen fan in nije map yn de holle dat de map-ID brûkt wurd om de mappen tusken apparaten mei-inoar te ferbinen. Se binne haadlettergefoelich en moatte oer alle apparaten eksakt oerienkomme.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "Jo kinne ek ien fan dizze tichtbye apparaten selektearje:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Jo kinne jo kar op elk stuit oanpasse yn it Ynstellingsdialooch.",
|
||||
"You can read more about the two release channels at the link below.": "Jo kinne mear lêze oer de twa útjeftekanalen fia de ûndersteande link.",
|
||||
"You must keep at least one version.": "Jo moatte minstens ien ferzje bewarje.",
|
||||
|
||||
@@ -158,8 +158,8 @@
|
||||
"Please consult the release notes before performing a major upgrade.": "Nagyobb frissítés előtt ellenőrizni kell a kiadási megjegyzéseket.",
|
||||
"Please set a GUI Authentication User and Password in the Settings dialog.": "Be kell állítani a grafikus felület felhasználónevét és jelszavát a Beállítások párbeszédablakban.",
|
||||
"Please wait": "Türelem",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Prefix indicating that the file can be deleted if preventing directory removal",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Prefix indicating that the pattern should be matched without case sensitivity",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Előtag, amely jelzi, hogy a fájl törölhető, ha tiltva van a mappák eltávolítása",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Előtag, amely jelzi, hogy a mintát nagy- ill. kisbetűérzékenység nélkül kell illeszteni.",
|
||||
"Preview": "Előnézet",
|
||||
"Preview Usage Report": "Használati jelentés áttekintése",
|
||||
"Quick guide to supported patterns": "Rövid útmutató a használható mintákról",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Új eszköz hozzáadásakor nem szabad elfeledkezni arról, hogy a másik oldalon ezt az eszközt is hozzá kell adni.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Új eszköz hozzáadásakor észben kell tartani, hogy a mappaazonosító arra való, hogy összekösse a mappákat az eszközökön. Az azonosító kisbetű-nagybetű érzékeny és pontosan egyeznie kell az eszközökön.",
|
||||
"Yes": "Igen",
|
||||
"You can also select one of these nearby devices:": "Az alábbi közelben lévő eszközök közül lehet választani:",
|
||||
"You can change your choice at any time in the Settings dialog.": "A beállításoknál bármikor módosíthatod a választásodat.",
|
||||
"You can read more about the two release channels at the link below.": "A két kiadási csatornáról az alábbi linken olvashatsz további információkat.",
|
||||
"You must keep at least one version.": "Legalább egy verziót meg kell tartani.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.",
|
||||
"Yes": "Yes",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You must keep at least one version.": "You must keep at least one version.",
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
"GUI Listen Addresses": "Indirizzi dell'Interfaccia Grafica",
|
||||
"GUI Theme": "Tema GUI",
|
||||
"Generate": "Genera",
|
||||
"Global Changes": "Modificazioni Globali",
|
||||
"Global Changes": "Modifiche Globali",
|
||||
"Global Discovery": "Individuazione Globale",
|
||||
"Global Discovery Servers": "Server di Individuazione Globale",
|
||||
"Global State": "Stato Globale",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Quando si aggiunge un nuovo dispositivo, tenere presente che il dispositivo deve essere aggiunto anche dall'altra parte.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Quando aggiungi una nuova cartella, ricordati che gli ID vengono utilizzati per collegare le cartelle nei dispositivi. Distinguono maiuscole e minuscole e devono corrispondere esattamente su tutti i dispositivi.",
|
||||
"Yes": "Sì",
|
||||
"You can also select one of these nearby devices:": "È anche possibile selezionare uno di questi dispositivi nelle vicinanze:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Puoi sempre cambiare la tua scelta nel dialogo Impostazioni.",
|
||||
"You can read more about the two release channels at the link below.": "Puoi ottenere piu informazioni riguarda i due canali di rilascio nel collegamento sottostante.",
|
||||
"You must keep at least one version.": "È necessario mantenere almeno una versione.",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"A device with that ID is already added.": "指定されたIDのデバイスは登録済みです。",
|
||||
"A negative number of days doesn't make sense.": "負の日数は指定できません。",
|
||||
"A new major version may not be compatible with previous versions.": "新しいメジャーバージョンは以前のバージョンと互換性がないかもしれません。",
|
||||
"A negative number of days doesn't make sense.": "日数は0以上で指定してください。",
|
||||
"A new major version may not be compatible with previous versions.": "新しいメジャーバージョンは以前のバージョンと互換性がない場合があります。",
|
||||
"API Key": "APIキー",
|
||||
"About": "Syncthingについて",
|
||||
"Action": "動作",
|
||||
@@ -10,24 +10,24 @@
|
||||
"Add Device": "デバイスを追加",
|
||||
"Add Folder": "フォルダーを追加",
|
||||
"Add Remote Device": "接続先デバイスを追加",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "紹介者デバイスから紹介されたデバイスは、相互に共有しているフォルダーがある場合、このデバイス上でも登録されます。",
|
||||
"Add new folder?": "新しいフォルダーとして追加しますか?",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "紹介者デバイスから紹介されたデバイスは、相互に共有しているフォルダーがある場合、このデバイス上にも追加されます。",
|
||||
"Add new folder?": "新しいフォルダーとして追加しますか?",
|
||||
"Address": "アドレス",
|
||||
"Addresses": "アドレス",
|
||||
"Advanced": "高度な設定",
|
||||
"Advanced Configuration": "高度な設定",
|
||||
"Advanced settings": "高度な設定",
|
||||
"All Data": "全てのデータ",
|
||||
"Allow Anonymous Usage Reporting?": "匿名で利用状況をレポートすることを許可しますか?",
|
||||
"Allow Anonymous Usage Reporting?": "匿名で使用状況をレポートすることを許可しますか?",
|
||||
"Allowed Networks": "許可されているネットワーク",
|
||||
"Alphabetic": "アルファベット順",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "外部コマンドにバージョン管理を任せます。ここで指定するコマンドは、共有フォルダーからファイルを削除するものでなくてはなりません。",
|
||||
"An external command handles the versioning. It has to remove the file from the synced folder.": "外部コマンドにバージョンを管理させます。ここで指定するコマンドは、同期フォルダーからファイルを削除するものでなくてはなりません。",
|
||||
"Anonymous Usage Reporting": "匿名での利用状況レポート",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "紹介者デバイス上で設定されたデバイスは、このデバイス上でも追加されます。",
|
||||
"Automatic upgrade now offers the choice between stable releases and release candidates.": "自動アップグレードは、安定リリース版とリリース候補版のいずれかを選べるようになりました。",
|
||||
"Anonymous Usage Reporting": "匿名での使用状況レポート",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "紹介者デバイス上で設定されたデバイスは、このデバイス上にも追加されます。",
|
||||
"Automatic upgrade now offers the choice between stable releases and release candidates.": "自動アップグレードは、安定版とリリース候補版のいずれかを選べるようになりました。",
|
||||
"Automatic upgrades": "自動アップグレード",
|
||||
"Be careful!": "注意してください。",
|
||||
"Be careful!": "注意!",
|
||||
"Bugs": "バグ",
|
||||
"CPU Utilization": "CPU使用率",
|
||||
"Changelog": "更新履歴",
|
||||
@@ -35,7 +35,7 @@
|
||||
"Click to see discovery failures": "接続に失敗した探索サーバーを確認するにはクリックしてください",
|
||||
"Close": "閉じる",
|
||||
"Command": "コマンド",
|
||||
"Comment, when used at the start of a line": "行頭で使用された場合、コメント行",
|
||||
"Comment, when used at the start of a line": "行頭で使用するとコメント行になります",
|
||||
"Compression": "圧縮",
|
||||
"Configured": "設定値",
|
||||
"Connection Error": "接続エラー",
|
||||
@@ -45,12 +45,12 @@
|
||||
"Copyright © 2014-2016 the following Contributors:": "Copyright © 2014-2016 the following Contributors:",
|
||||
"Copyright © 2014-2017 the following Contributors:": "Copyright © 2014-2017 the following Contributors:",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "無視パターンを作成中。既存のファイルが {{path}} にある場合は上書きされます。",
|
||||
"Danger!": "危険",
|
||||
"Danger!": "危険!",
|
||||
"Deleted": "削除",
|
||||
"Device": "デバイス",
|
||||
"Device \"{%name%}\" ({%device%} at {%address%}) wants to connect. Add new device?": "デバイス「{{name}}」 ({{address}} の {{device}}) が接続を求めています。新しいデバイスとして追加しますか?",
|
||||
"Device \"{%name%}\" ({%device%} at {%address%}) wants to connect. Add new device?": "デバイス「{{name}}」 ({{address}} の {{device}}) が接続を求めています。新しいデバイスとして追加しますか?",
|
||||
"Device ID": "デバイスID",
|
||||
"Device Identification": "デバイス識別情報",
|
||||
"Device Identification": "デバイスID",
|
||||
"Device Name": "デバイス名",
|
||||
"Devices": "デバイス",
|
||||
"Disconnected": "切断中",
|
||||
@@ -65,24 +65,24 @@
|
||||
"Edit Device": "デバイスの編集",
|
||||
"Edit Folder": "フォルダーの編集",
|
||||
"Editing": "編集中",
|
||||
"Editing {%path%}.": "{{path}} を編集中。",
|
||||
"Editing {%path%}.": "{{path}} を編集中",
|
||||
"Enable NAT traversal": "NATトラバーサルを有効にする",
|
||||
"Enable Relaying": "中継サーバー経由の通信を有効にする",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "0以上の数 (例: 2.35) を入力し、単位を選択してください。パーセントはディスク容量全体に対する割合です。",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "非特権ポート番号 (1024 - 65535) を入力してください。",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "アドレスを指定する場合は「tcp://IPアドレス:ポート」または「tcp://ホスト名:ポート」をコンマで区切って入力してください。自動探索を行う場合は「dynamic」と入力してください。",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "アドレスを指定する場合は「tcp://IPアドレス:ポート, tcp://ホスト名:ポート」のようにコンマで区切って入力してください。自動探索を行う場合は「dynamic」と入力してください。",
|
||||
"Enter ignore patterns, one per line.": "無視するファイル名のパターンを、一行につき一条件で入力してください。",
|
||||
"Error": "エラー",
|
||||
"External File Versioning": "外部バージョン管理",
|
||||
"Failed Items": "失敗した項目",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "お使いのネットワークにIPv6の接続性がない場合、IPv6のサーバーへの接続に失敗しても異常ではありません。",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "お使いのネットワークがIPv6を利用していない場合、IPv6のサーバーへの接続に失敗しても異常ではありません。",
|
||||
"File Pull Order": "ファイルを取得する順序",
|
||||
"File Versioning": "ファイルのバージョン管理",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "ファイルの変更を探すときにパーミッションを無視します。FATファイルシステムでご利用ください。",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Syncthingによって置き換えられたり削除されたりしたファイルは、.stversions ディレクトリに移動します。",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Syncthingがファイルを置き換えたり削除したりするとき、古い内容を .stversions フォルダーに移動します。",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Syncthingによって置き換えられたり削除されたりしたファイルは、タイムスタンプ付きのファイル名で .stversions ディレクトリに移動します。",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Syncthingがファイルを置き換えたり削除したりするとき、古い内容はファイル名にタイムスタンプを付けて .stversions フォルダーに移動します。",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "パーミッションの変更を検知しません。FATファイルシステムでご利用ください。",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Syncthingによって置き換えられたり削除されたファイルは、.stversions ディレクトリに移動します。",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Syncthingによって置き換えられたり削除されたファイルは、.stversions フォルダーに移動します。",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Syncthingによって置き換えられたり削除されたファイルは、タイムスタンプ付きのファイル名で .stversions ディレクトリに移動します。",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Syncthingによって置き換えられたり削除されたファイルは、タイムスタンプ付きのファイル名で .stversions フォルダーに移動します。",
|
||||
"Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.": "ファイルを他のデバイスによる変更から保護します。一方、このデバイスでの変更は他のデバイスに送信されます。",
|
||||
"Folder": "フォルダー",
|
||||
"Folder ID": "フォルダーID",
|
||||
@@ -94,12 +94,12 @@
|
||||
"GUI Authentication Password": "GUI認証パスワード",
|
||||
"GUI Authentication User": "GUI認証ユーザー名",
|
||||
"GUI Listen Address": "GUI待ち受けアドレス",
|
||||
"GUI Listen Addresses": "GUI待ち受けアドレスリスト",
|
||||
"GUI Listen Addresses": "GUI待ち受けアドレス",
|
||||
"GUI Theme": "GUIテーマ",
|
||||
"Generate": "生成",
|
||||
"Global Changes": "全変更点",
|
||||
"Global Discovery": "大域探索",
|
||||
"Global Discovery Servers": "大域探索サーバー",
|
||||
"Global Discovery": "グローバル探索",
|
||||
"Global Discovery Servers": "グローバル探索サーバー",
|
||||
"Global State": "グローバル状態",
|
||||
"Help": "ヘルプ",
|
||||
"Home page": "ホームページ",
|
||||
@@ -107,14 +107,14 @@
|
||||
"Ignore Patterns": "無視するファイル名",
|
||||
"Ignore Permissions": "パーミッションを無視する",
|
||||
"Incoming Rate Limit (KiB/s)": "下り帯域制限 (KiB/s)",
|
||||
"Incorrect configuration may damage your folder contents and render Syncthing inoperable.": "間違った設定を行うと、フォルダーの内容を壊したり、Syncthingを操作不能にしたりする可能性があります。",
|
||||
"Incorrect configuration may damage your folder contents and render Syncthing inoperable.": "間違った設定を行うと、フォルダーの内容を壊したり、Syncthingが動作しなくなる可能性があります。",
|
||||
"Introduced By": "紹介元",
|
||||
"Introducer": "紹介者デバイス",
|
||||
"Inversion of the given condition (i.e. do not exclude)": "条件の否定 (つまり、無視しないという意味になります)",
|
||||
"Keep Versions": "保存するバージョンの数",
|
||||
"Keep Versions": "保持するバージョン数",
|
||||
"Largest First": "大きい順",
|
||||
"Last File Received": "最後に受信したファイル",
|
||||
"Last Scan": "最終スキャン時刻",
|
||||
"Last Scan": "最終スキャン日時",
|
||||
"Last seen": "最終接続日時",
|
||||
"Later": "後で設定",
|
||||
"Latest Change": "最終変更内容",
|
||||
@@ -125,7 +125,7 @@
|
||||
"Local State (Total)": "ローカル状態 (合計)",
|
||||
"Major Upgrade": "メジャーアップグレード",
|
||||
"Master": "マスター",
|
||||
"Maximum Age": "最大寿命",
|
||||
"Maximum Age": "最大保存日数",
|
||||
"Metadata Only": "メタデータのみ",
|
||||
"Minimum Free Disk Space": "同期を停止する最小空きディスク容量",
|
||||
"Move to top of queue": "最優先にする",
|
||||
@@ -149,9 +149,9 @@
|
||||
"Outgoing Rate Limit (KiB/s)": "上り帯域制限 (KiB/s)",
|
||||
"Override Changes": "他のデバイスの変更を上書きする",
|
||||
"Path": "パス",
|
||||
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "ローカルコンピュータ上のフォルダーパス。存在しない場合は作成されます。チルダ (~) で次のフォルダーを短縮入力できます:",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "古いバージョンを保存するパス (空欄の場合、デフォルトで共有フォルダー内の .stversions ディレクトリになります)。",
|
||||
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "古いバージョンを保存するパス (空欄の場合、デフォルトで .stversions になります)。",
|
||||
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "ローカルコンピュータ上のフォルダーパス。フォルダーが存在しない場合は作成されます。チルダ (~) で次のフォルダーを短縮入力できます:",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "古いバージョンを保存するパス (空欄の場合、デフォルトで共有フォルダー内の .stversions ディレクトリ)",
|
||||
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "古いバージョンを保存するパス (空欄の場合、デフォルトでフォルダー内の .stversions フォルダー)",
|
||||
"Pause": "一時停止",
|
||||
"Pause All": "すべて一時停止",
|
||||
"Paused": "一時停止中",
|
||||
@@ -161,8 +161,8 @@
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "このファイルが中に残っているためにディレクトリを削除できない場合、このファイルごと消してもよいことを示す接頭辞",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "大文字・小文字を同一視してマッチさせる接頭辞",
|
||||
"Preview": "プレビュー",
|
||||
"Preview Usage Report": "利用状況レポートのプレビュー",
|
||||
"Quick guide to supported patterns": "サポートされているパターンの簡易ガイド",
|
||||
"Preview Usage Report": "使用状況レポートのプレビュー",
|
||||
"Quick guide to supported patterns": "サポートされているパターンのクイックガイド",
|
||||
"RAM Utilization": "メモリ使用量",
|
||||
"Random": "ランダム",
|
||||
"Reduced by ignore patterns": "無視パターン該当分を除く",
|
||||
@@ -191,28 +191,28 @@
|
||||
"Share": "共有",
|
||||
"Share Folder": "フォルダーを共有する",
|
||||
"Share Folders With Device": "このデバイスと共有するフォルダー",
|
||||
"Share With Devices": "共有対象のデバイス",
|
||||
"Share this folder?": "このフォルダーを共有しますか?",
|
||||
"Shared With": "共有相手",
|
||||
"Share With Devices": "共有するデバイス",
|
||||
"Share this folder?": "このフォルダーを共有しますか?",
|
||||
"Shared With": "共有中のデバイス",
|
||||
"Show ID": "IDを表示",
|
||||
"Show QR": "QRコードを表示",
|
||||
"Shown instead of Device ID in the cluster status. Will be advertised to other devices as an optional default name.": "ステータス画面でデバイスIDの代わりに表示されます。他のデバイスに対してもデフォルトの名前として通知されます。",
|
||||
"Shown instead of Device ID in the cluster status. Will be updated to the name the device advertises if left empty.": "ステータス画面でデバイスIDの代わりに表示されます。空欄の場合、相手デバイスが通知してきた名前に更新されます。",
|
||||
"Shown instead of Device ID in the cluster status. Will be updated to the name the device advertises if left empty.": "ステータス画面でデバイスIDの代わりに表示されます。空欄にすると相手側デバイスが通知してきた名前で更新されます。",
|
||||
"Shutdown": "シャットダウン",
|
||||
"Shutdown Complete": "シャットダウン完了",
|
||||
"Simple File Versioning": "単純バージョン管理",
|
||||
"Single level wildcard (matches within a directory only)": "ワイルドカード (単一のディレクトリ内だけでマッチします)",
|
||||
"Smallest First": "小さい順",
|
||||
"Source Code": "ソースコード",
|
||||
"Stable releases and release candidates": "安定リリース版とリリース候補版",
|
||||
"Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "安定リリース版はおよそ2週間後にリリースされます。その間にリリース候補版としてテストされます。",
|
||||
"Stable releases only": "安定リリース版のみ",
|
||||
"Stable releases and release candidates": "安定版とリリース候補版",
|
||||
"Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "安定版は、リリース候補版としてのテスト後およそ2週間でリリースされます。",
|
||||
"Stable releases only": "安定版のみ",
|
||||
"Staggered File Versioning": "期間別バージョン管理",
|
||||
"Start Browser": "起動時にウェブブラウザーで状態を表示する",
|
||||
"Statistics": "統計情報",
|
||||
"Stopped": "停止中",
|
||||
"Support": "サポート",
|
||||
"Sync Protocol Listen Addresses": "Syncプロトコルの待ち受けアドレスリスト",
|
||||
"Sync Protocol Listen Addresses": "同期プロトコルの待ち受けアドレス",
|
||||
"Syncing": "同期中",
|
||||
"Syncthing has been shut down.": "Syncthingをシャットダウンしました。",
|
||||
"Syncthing includes the following software or portions thereof:": "Syncthingは以下のソフトウェアまたはその一部を内包しています:",
|
||||
@@ -223,26 +223,26 @@
|
||||
"The Syncthing admin interface is configured to allow remote access without a password.": "Syncthingの管理画面が、パスワードなしで外部からアクセスできるように設定されています。",
|
||||
"The aggregated statistics are publicly available at the URL below.": "集計結果は次のURLで公開されています。",
|
||||
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "設定が保存されましたが、まだ有効になっていません。新しい設定を有効にするにはSyncthingを再起動してください。",
|
||||
"The device ID cannot be blank.": "デバイスIDは空欄にできません。",
|
||||
"The device ID to enter here can be found in the \"Actions > Show ID\" dialog on the other device. Spaces and dashes are optional (ignored).": "ここに入力するデバイスIDは、接続したい相手側デバイスの [メニュー]→[IDを表示] で確認することができます。スペースとハイフンは入力しなくてもかまいません。",
|
||||
"The encrypted usage report is sent daily. It is used to track common platforms, folder sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.": "利用状況レポートは暗号化されて毎日送信されます。この情報はプラットフォーム、フォルダーの大きさ、アプリのバージョンを調査するために使われます。送信するデータセットが変更された場合、このダイアログで再度確認が求められます。",
|
||||
"The device ID cannot be blank.": "デバイスIDを入力してください。",
|
||||
"The device ID to enter here can be found in the \"Actions > Show ID\" dialog on the other device. Spaces and dashes are optional (ignored).": "ここに入力するデバイスIDは、接続したい相手側デバイスの [メニュー]→[IDを表示] で確認できます。スペースとハイフンは入力しなくてもかまいません。",
|
||||
"The encrypted usage report is sent daily. It is used to track common platforms, folder sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.": "使用状況レポートは暗号化されて毎日送信されます。この情報はプラットフォーム、フォルダーのサイズ、アプリケーションのバージョンを調査するために使われます。送信するデータセットが変更された場合、このダイアログで再度確認が求められます。",
|
||||
"The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional.": "入力されたデバイスIDが正しくありません。デバイスIDは52文字または56文字で、アルファベットと数字からなります。スペースとハイフンは入力してもしなくてもかまいません。",
|
||||
"The first command line parameter is the folder path and the second parameter is the relative path in the folder.": "第1コマンドライン引数はフォルダーのパス、第2引数はフォルダー内の相対パスです。",
|
||||
"The folder ID cannot be blank.": "フォルダーIDは空欄にできません。",
|
||||
"The folder ID must be unique.": "フォルダーIDが重複しています。",
|
||||
"The folder path cannot be blank.": "フォルダーパスは空欄にできません。",
|
||||
"The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.": "保存間隔は次の通りです。最近1時間は30秒ごとに古いバージョンを保存します。同様に、最近1日間は1時間ごとに、最近30日間は1日ごとに、その後最大寿命までは1週間ごとに、古いバージョンを保存します。",
|
||||
"The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.": "保存間隔は次の通りです。初めの1時間は30秒ごとに古いバージョンを保存します。同様に、初めの1日間は1時間ごと、初めの30日間は1日ごと、その後最大保存日数までは1週間ごとに、古いバージョンを保存します。",
|
||||
"The following items could not be synchronized.": "以下の項目は同期できませんでした。",
|
||||
"The maximum age must be a number and cannot be blank.": "最大寿命は数値を指定してください。空欄にはできません。",
|
||||
"The maximum time to keep a version (in days, set to 0 to keep versions forever).": "古いバージョンを保存する最大日数 (0を指定すると無期限になります)。",
|
||||
"The maximum age must be a number and cannot be blank.": "最大保存日数には数値を指定してください。空欄にはできません。",
|
||||
"The maximum time to keep a version (in days, set to 0 to keep versions forever).": "古いバージョンを保持する最大日数 (0で無期限)",
|
||||
"The minimum free disk space percentage must be a non-negative number between 0 and 100 (inclusive).": "最小空きディスク容量はパーセントで、0から100の値を入力してください。",
|
||||
"The number of days must be a number and cannot be blank.": "日数は数値を指定してください。空欄にはできません。",
|
||||
"The number of days to keep files in the trash can. Zero means forever.": "ゴミ箱にファイルを保存する日数。0を指定すると無期限になります。",
|
||||
"The number of old versions to keep, per file.": "ファイルごとに古いバージョンをいくつ保存するかを指定します。",
|
||||
"The number of versions must be a number and cannot be blank.": "保存するバージョンの数は数値を指定してください。空欄にはできません。",
|
||||
"The path cannot be blank.": "パスは空欄にできません。",
|
||||
"The rate limit must be a non-negative number (0: no limit)": "帯域制限の値として負の数は指定できません (0を指定すると無制限になります)。",
|
||||
"The rescan interval must be a non-negative number of seconds.": "再スキャン間隔として負の数は指定できません。",
|
||||
"The number of days to keep files in the trash can. Zero means forever.": "ゴミ箱でファイルを保持する日数 (0で無期限)",
|
||||
"The number of old versions to keep, per file.": "ファイルごとに古いバージョンをいくつ保持するかを指定します。",
|
||||
"The number of versions must be a number and cannot be blank.": "保持するバージョン数は数値を指定してください。空欄にはできません。",
|
||||
"The path cannot be blank.": "パスを入力してください。",
|
||||
"The rate limit must be a non-negative number (0: no limit)": "帯域制限値は0以上で指定して下さい。 (0で無制限)",
|
||||
"The rescan interval must be a non-negative number of seconds.": "再スキャン間隔は0秒以上で指定してください。",
|
||||
"They are retried automatically and will be synced when the error is resolved.": "エラーが解決すると、自動的に再試行され同期されます。",
|
||||
"This Device": "このデバイス",
|
||||
"This can easily give hackers access to read and change any files on your computer.": "この設定のままでは、あなたのコンピューターにある任意のファイルを、他者が簡単に盗み見たり書き換えたりすることができます。",
|
||||
@@ -261,21 +261,22 @@
|
||||
"Upgrading": "アップグレード中",
|
||||
"Upload Rate": "アップロード速度",
|
||||
"Uptime": "稼働時間",
|
||||
"Usage reporting is always enabled for candidate releases.": "リリース候補版では常に利用状況レポートが送信されます。",
|
||||
"Usage reporting is always enabled for candidate releases.": "リリース候補版では常に使用状況レポートが送信されます。",
|
||||
"Use HTTPS for GUI": "GUIにHTTPSを使用する",
|
||||
"Version": "バージョン",
|
||||
"Versions Path": "古いバージョンを保存するパス",
|
||||
"Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.": "古いバージョンは、最大寿命もしくは期間ごとの最大保存数を超えた場合、自動的に削除されます。",
|
||||
"Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.": "古いバージョンは、最大保存日数もしくは期間ごとの最大保存数を超えた場合、自動的に削除されます。",
|
||||
"Warning, this path is a parent directory of an existing folder \"{%otherFolder%}\".": "警告: 入力されたパスは、設定済みのフォルダー「{{otherFolder}}」の親ディレクトリです。",
|
||||
"Warning, this path is a parent directory of an existing folder \"{%otherFolderLabel%}\" ({%otherFolder%}).": "警告: 入力されたパスは、設定済みのフォルダー「{{otherFolderLabel}}」 ({{otherFolder}}) の親ディレクトリです。",
|
||||
"Warning, this path is a subdirectory of an existing folder \"{%otherFolder%}\".": "警告: 入力されたパスは、設定済みのフォルダー「{{otherFolder}}」のサブディレクトリです。",
|
||||
"Warning, this path is a subdirectory of an existing folder \"{%otherFolderLabel%}\" ({%otherFolder%}).": "警告: 入力されたパスは、設定済みのフォルダー「{{otherFolderLabel}}」 ({{otherFolder}}) のサブディレクトリです。",
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "新しいデバイスを追加する際は、相手側のデバイスにもこのデバイスを追加する必要があることに留意してください。",
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "新しいデバイスを追加する際は、相手側デバイスにもこのデバイスを追加してください。",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "新しいフォルダーを追加する際、フォルダーIDはデバイス間でフォルダーの対応づけに使われることに注意してください。フォルダーIDは大文字と小文字が区別され、共有するすべてのデバイスの間で完全に一致しなくてはなりません。",
|
||||
"Yes": "はい",
|
||||
"You can change your choice at any time in the Settings dialog.": "どちらを選ぶかは設定ダイアログからいつでも変更できます。",
|
||||
"You can also select one of these nearby devices:": "近くに検出された以下のデバイスの一つを選択できます。",
|
||||
"You can change your choice at any time in the Settings dialog.": "この設定はいつでも変更できます。",
|
||||
"You can read more about the two release channels at the link below.": "2種類のリリースチャネルについての詳細は、以下のリンク先を参照してください。",
|
||||
"You must keep at least one version.": "少なくとも一つのバージョンを保存してください。",
|
||||
"You must keep at least one version.": "少なくとも一つのバージョンを保持する必要があります。",
|
||||
"days": "日",
|
||||
"directories": "個のディレクトリ",
|
||||
"files": "個のファイル",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "새 장치를 추가할 시 추가한 기기 쪽에서도 이 장치를 추가해야 합니다.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "새 폴더를 추가할 시 폴더 ID는 장치간에 폴더를 묶을 때 사용됩니다. 대소문자를 구분하며 모든 장치에서 같은 ID를 사용해야 합니다.",
|
||||
"Yes": "예",
|
||||
"You can also select one of these nearby devices:": "주변 기기 중 하나를 선택할 수 있습니다:",
|
||||
"You can change your choice at any time in the Settings dialog.": "설정창 에서 언제든지 원하시는 때에 설정을 변경하는 것이 가능합니다.",
|
||||
"You can read more about the two release channels at the link below.": "이 두 개의 출시 채널에 대해 아래 링크에서 자세하게 읽어 보실 수 있습니다.",
|
||||
"You must keep at least one version.": "최소 한 개의 버전은 유지해야 합니다.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Pridėdami įrenginį, turėkite omeny, kad šis įrenginys taip pat turi būti pridėtas kitoje pusėje.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Kai įvedate naują aplanką neužmirškite, kad jis bus naudojamas visuose įrenginiuose. Svarbu visur įvesti visiškai tokį pat aplanko vardą neužmirštant apie didžiąsias ir mažąsias raides.",
|
||||
"Yes": "Taip",
|
||||
"You can also select one of these nearby devices:": "Jūs taip pat galite pasirinkti vieną iš šių šalia esančių įrenginių:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Jūs bet kuriuo metu galite pakeisti savo pasirinkimą nustatymų dialoge.",
|
||||
"You can read more about the two release channels at the link below.": "Jūs galite perskaityti daugiau apie šiuos du laidos kanalus, pasinaudodami žemiau esančia nuoroda.",
|
||||
"You must keep at least one version.": "Būtina saugoti bent vieną versiją.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Når en ny mappe blir lagt til, husk at Mappe-ID blir brukt til å binde sammen mapper mellom enheter. Det er forskjell på store og små bokstaver, så IDene må være identiske på alle enhetene.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Du kan endre ditt valg når som helst i innstillingene.",
|
||||
"You can read more about the two release channels at the link below.": "Du kan lese mer om de to nye utgivelseskanalene i lenken nedenfor.",
|
||||
"You must keep at least one version.": "Du må beholde minst én versjon",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"Add": "Toevoegen",
|
||||
"Add Device": "Apparaat toevoegen",
|
||||
"Add Folder": "Map toevoegen",
|
||||
"Add Remote Device": "Voeg extern apparaat toe",
|
||||
"Add Remote Device": "Extern apparaat toevoegen",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "Voeg apparaten van het introductieapparaat toe aan de lijst met apparaten voor gemeenschappelijk gedeelde mappen.",
|
||||
"Add new folder?": "Nieuwe map toevoegen?",
|
||||
"Address": "Adres",
|
||||
@@ -32,7 +32,7 @@
|
||||
"CPU Utilization": "CPU-gebruik",
|
||||
"Changelog": "Logboek",
|
||||
"Clean out after": "Schoon op na",
|
||||
"Click to see discovery failures": "Klik om ontdekkingsproblemen weer te geven",
|
||||
"Click to see discovery failures": "Klikken om ontdekkingsproblemen weer te geven",
|
||||
"Close": "Sluiten",
|
||||
"Command": "Commando",
|
||||
"Comment, when used at the start of a line": "Reageer indien gebruikt aan het begin van een lijn.",
|
||||
@@ -63,13 +63,13 @@
|
||||
"Downloading": "Bezig met downloaden",
|
||||
"Edit": "Bewerk",
|
||||
"Edit Device": "Bewerk apparaat",
|
||||
"Edit Folder": "Bewerk map",
|
||||
"Edit Folder": "Map bewerken",
|
||||
"Editing": "Bezig met bewerken",
|
||||
"Editing {%path%}.": "Bezig met bewerken van {{path}}.",
|
||||
"Enable NAT traversal": "Activeer NAT traversal",
|
||||
"Enable Relaying": "Activeer doorsturen",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Enter a non-privileged port number (1024 - 65535).",
|
||||
"Enable NAT traversal": "NAT traversal inschakelen",
|
||||
"Enable Relaying": "Doorsturen inschakelen",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Voer een positief nummer in (bijv. \"2.35\") en selecteer een eenheid. Percentages zijn een onderdeel van de totale schijfgrootte.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Voer een niet-geprivilegieerd poortnummer in (1024 - 65535).",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Voer door komma's gescheiden (\"tcp://ip:port\", \"tcp://host:port\") adressen in of voer \"dynamisch\" in om automatische ontdekking van het adres uit te voeren.",
|
||||
"Enter ignore patterns, one per line.": "Voer negeerpatronen in, één per regel.",
|
||||
"Error": "Fout",
|
||||
@@ -158,8 +158,8 @@
|
||||
"Please consult the release notes before performing a major upgrade.": "Lees eerst de release notes voordat u een grote update uitvoert.",
|
||||
"Please set a GUI Authentication User and Password in the Settings dialog.": "Stel een gebruikersnaam en wachtwoord in bij 'Instellingen'.",
|
||||
"Please wait": "Even geduld",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Prefix indicating that the file can be deleted if preventing directory removal",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Prefix indicating that the pattern should be matched without case sensitivity",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Voorvoegsel dat aangeeft dat het bestand kan worden verwijderd als het bestand het verwijderen van een map voorkomt",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Voorvoegsel dat aangeeft dat het patroon hoofdletterongevoelig moet worden vergeleken",
|
||||
"Preview": "Preview",
|
||||
"Preview Usage Report": "Preview gebruiksstatistieken",
|
||||
"Quick guide to supported patterns": "Snelgids voor ondersteunde patronen",
|
||||
@@ -247,7 +247,7 @@
|
||||
"This Device": "Dit apparaat",
|
||||
"This can easily give hackers access to read and change any files on your computer.": "Dit kan kwaadwilligen eenvoudig toegang geven tot het lezen en wijzigen van bestanden op jouw computer.",
|
||||
"This is a major version upgrade.": "Dit is een grote update.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "This setting controls the free space required on the home (i.e., index database) disk.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "Deze instelling beheert de benodigde vrije ruimte op de home (index database) schijf.",
|
||||
"Time": "Tijd",
|
||||
"Trash Can File Versioning": "Versiebeheer bestanden prullenbak",
|
||||
"Type": "Type",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Wanneer een nieuw toestel wordt toegevoegd, houd er dan rekening mee dat dit toestel ook aan de andere kant moet worden toegevoegd.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Houd er bij het toevoegen van nieuwe mappen rekening mee dat het map-ID gebruikt wordt om mappen tussen apparaten te verbinden. Dit ID is hoofdlettergevoelig en moet identiek zijn op andere apparaten.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "U kunt ook een van de apparaten die dichtbij zijn selecteren:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Je kan je keuze op elk moment aanpassen in de Instellingen.",
|
||||
"You can read more about the two release channels at the link below.": "Je kan meer te weten komen over de twee uitgavekanalen via de link hieronder.",
|
||||
"You must keep at least one version.": "Minstens 1 versie moet bewaard blijven.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Hugs at når ei ny eining vert lagt til, må ho òg leggjast til på andre sida.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Hugs at når ei ny mappe vert lagt til, vert mappe-ID-en brukt til å binda saman mappene mellom einingane. Det er skilnad på store og små bokstavar, så ID-ane må vera identiske på alle einingane.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You must keep at least one version.": "Du må behalda minst ein versjon.",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"A device with that ID is already added.": "Urządzenie o tym ID jest już dodane.",
|
||||
"A device with that ID is already added.": "Urządzenie o tym ID już istnieje.",
|
||||
"A negative number of days doesn't make sense.": "Ujemna ilość dni nie ma sensu.",
|
||||
"A new major version may not be compatible with previous versions.": "Nowa wersja może być niekompatybilna z poprzednimi wersjami.",
|
||||
"API Key": "Klucz API",
|
||||
@@ -10,7 +10,7 @@
|
||||
"Add Device": "Dodaj urządzenie",
|
||||
"Add Folder": "Dodaj folder",
|
||||
"Add Remote Device": "Dodaj urządzenie zdalne",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "Add devices from the introducer to our device list, for mutually shared folders.",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "Dodaj urządzenia od wprowadzającego do tej maszyny alby obustronnie dzielić katalogi.",
|
||||
"Add new folder?": "Dodać nowy folder?",
|
||||
"Address": "Adres",
|
||||
"Addresses": "Adresy",
|
||||
@@ -19,20 +19,20 @@
|
||||
"Advanced settings": "Ustawienia zaawansowane",
|
||||
"All Data": "Wszystkie dane",
|
||||
"Allow Anonymous Usage Reporting?": "Zezwalaj na anonimowe statystyki użycia?",
|
||||
"Allowed Networks": "Allowed Networks",
|
||||
"Allowed Networks": "Dozwolone sieci",
|
||||
"Alphabetic": "Alfabetycznie",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "An external command handles the versioning. It has to remove the file from the shared folder.",
|
||||
"An external command handles the versioning. It has to remove the file from the synced folder.": "Zewnętrzna komenda obsługuje kontrolę wersji. Musi ona usunąć ten plik z synchronizowanego folderu.",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "Zewnętrzna komenda odpowiedzialna za wersjonowanie. Musi usunąć plik ze współdzielonego folderu.",
|
||||
"An external command handles the versioning. It has to remove the file from the synced folder.": "Zewnętrzna komenda odpowiedzialna za wersjonowanie. Musi usuwać ten plik z synchronizowanego folderu.",
|
||||
"Anonymous Usage Reporting": "Anonimowe statystyki użycia",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "Wszystkie urządzenia skonfigurowane na urządzeniu wprowadzającym zostaną dodane także do tego urządzenia.",
|
||||
"Automatic upgrade now offers the choice between stable releases and release candidates.": "Automatic upgrade now offers the choice between stable releases and release candidates.",
|
||||
"Automatic upgrade now offers the choice between stable releases and release candidates.": "Automatyczne aktualizacje pozwalają teraz wybrać pomiędzy wydaniami stabilnymi a wersjami kandydującymi.",
|
||||
"Automatic upgrades": "Automatyczne aktualizacje",
|
||||
"Be careful!": "Uważaj!",
|
||||
"Bugs": "Błędy",
|
||||
"CPU Utilization": "Użycie CPU",
|
||||
"Changelog": "Historia zmian",
|
||||
"Clean out after": "Uporządkuj",
|
||||
"Click to see discovery failures": "Click to see discovery failures",
|
||||
"Click to see discovery failures": "Kliknij aby zobaczyć błędy odnajdywania",
|
||||
"Close": "Zamknij",
|
||||
"Command": "Polecenie",
|
||||
"Comment, when used at the start of a line": "Komentarz, jeżeli użyty na początku linii",
|
||||
@@ -43,8 +43,8 @@
|
||||
"Copied from elsewhere": "Skopiowane z innego miejsca ",
|
||||
"Copied from original": "Skopiowane z oryginału",
|
||||
"Copyright © 2014-2016 the following Contributors:": "Copyright © 2014-2016: ",
|
||||
"Copyright © 2014-2017 the following Contributors:": "Copyright © 2014-2017 the following Contributors:",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "Creating ignore patterns, overwriting an existing file at {{path}}.",
|
||||
"Copyright © 2014-2017 the following Contributors:": "Prawa autorskie © 2014-2017 dla następujących autorów:",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "Ustawienie wzorów ignorowania, nadpisze istniejący plik w {{path}}.",
|
||||
"Danger!": "Niebezpieczne!",
|
||||
"Deleted": "Usunięto",
|
||||
"Device": "Urządzenie",
|
||||
@@ -56,7 +56,7 @@
|
||||
"Disconnected": "Rozłączony",
|
||||
"Discovered": "Odkryte",
|
||||
"Discovery": "Odnajdywanie",
|
||||
"Discovery Failures": "Discovery Failures",
|
||||
"Discovery Failures": "Błędy odnajdowania",
|
||||
"Documentation": "Dokumentacja",
|
||||
"Download Rate": "Prędkość pobierania",
|
||||
"Downloaded": "Pobrane",
|
||||
@@ -65,23 +65,23 @@
|
||||
"Edit Device": "Edytuj urządzenie",
|
||||
"Edit Folder": "Edytuj folder",
|
||||
"Editing": "Edytowanie",
|
||||
"Editing {%path%}.": "Editing {{path}}.",
|
||||
"Editing {%path%}.": "Edytowanie {{path}}.",
|
||||
"Enable NAT traversal": "Włącz trawersowanie NAT",
|
||||
"Enable Relaying": "Włącz przekazywanie",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Enter a non-privileged port number (1024 - 65535).",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Wpisz nieujemną liczbę (np. \"2.35\") oraz wybierz jednostkę. Wartość procentowa odnosi się do rozmiaru całego dysku.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Wpisz nieuprzywilejowany numer portu (1024-65535).",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Wpisz oddzielone przecinkiem adresy (\"tcp://ip:port\", \"tcp://host:port\") lub \"dynamic\" by przeprowadzić automatyczne odnalezienie adresu.",
|
||||
"Enter ignore patterns, one per line.": "Wprowadź wzorce ignorowania, jeden w każdej linii.",
|
||||
"Error": "Błąd",
|
||||
"External File Versioning": "Zewnętrzne wersjonowanie pliku",
|
||||
"Failed Items": "Niepowodzenia",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Błąd połączenia do serwerów IPv6 może wystąpić, jeśli brakuje połączenia po IPv6 w ogóle.",
|
||||
"File Pull Order": "Kolejność pobierania plików",
|
||||
"File Versioning": "Kontrola wersji",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "Uprawnienia plików są ignorowane przy poszukiwaniu zmian. Używaj w systemie plików FAT.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Files are moved to .stversions directory when replaced or deleted by Syncthing.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Pliki są przenoszone do folderu .stversions przez Syncthing, kiedy zostaną zmienione lub usunięte.",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Pliki przenoszone są do folderu .stversions gdy są zastępowane bądź usuwane przez Syncthing.",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Pliki są datowane i przenoszone do folderu .stversions przez Syncthing, kiedy zostaną zmienione lub usunięte.",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Pliki przenoszone są do wersji oznaczonych datą w folderze .stversions kiedy są zastępowane bądź usuwane przez Syncthing",
|
||||
"Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.": "Pliki są zabezpieczone przed zmianami na innym urządzeniu, jednak zmiany w tym urządzeniu będą wysłane do reszty.",
|
||||
"Folder": "Folder",
|
||||
@@ -93,11 +93,11 @@
|
||||
"GUI": "GUI",
|
||||
"GUI Authentication Password": "Hasło",
|
||||
"GUI Authentication User": "Użytkownik",
|
||||
"GUI Listen Address": "GUI Listen Address",
|
||||
"GUI Listen Address": "Adres nasłuchu GUI",
|
||||
"GUI Listen Addresses": "Adres nasłuchiwania",
|
||||
"GUI Theme": "Motyw GUI",
|
||||
"Generate": "Generuj",
|
||||
"Global Changes": "Globalne zmiany",
|
||||
"Global Changes": "Zmiany globalne",
|
||||
"Global Discovery": "Globalne odnajdywanie",
|
||||
"Global Discovery Servers": "Globalne serwery odkrywania",
|
||||
"Global State": "Status globalny",
|
||||
@@ -118,7 +118,7 @@
|
||||
"Last seen": "Ostatnio widziany",
|
||||
"Later": "Później",
|
||||
"Latest Change": "Ostatnia zmiana",
|
||||
"Learn more": "Learn more",
|
||||
"Learn more": "Zobacz więcej",
|
||||
"Listeners": "Nasłuchujący",
|
||||
"Local Discovery": "Lokalne odnajdywanie",
|
||||
"Local State": "Status lokalny",
|
||||
@@ -150,7 +150,7 @@
|
||||
"Override Changes": "Nadpisz zmiany",
|
||||
"Path": "Ścieżka",
|
||||
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Ścieżka do lokalnego folderu. Zostanie utworzona jeżeli nie istnieje.\nZnak tyldy (~) może zostać użyty jako skrót do",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "Ścieżka gdzie wersje będą przechowywane (pozostaw puste dla domyślnego folderu .stversions we współ. folderze).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "Ścieżka gdzie będą przechowywane wersje (pozostaw puste dla domyślnego folderu .stversions)",
|
||||
"Pause": "Zatrzymaj",
|
||||
"Pause All": "Zatrzymaj wszystkie",
|
||||
@@ -158,8 +158,8 @@
|
||||
"Please consult the release notes before performing a major upgrade.": "Zaleca się przeanalizowanie \"release notes\" przed przeprowadzeniem znaczącej aktualizacji.",
|
||||
"Please set a GUI Authentication User and Password in the Settings dialog.": "Ustaw proszę użytkownika i hasło dostępowe do GUI w Ustawieniach",
|
||||
"Please wait": "Proszę czekać",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Prefix indicating that the file can be deleted if preventing directory removal",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Prefix indicating that the pattern should be matched without case sensitivity",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Prefiks wskazujący, że plik może zostać usunięty w przypadku zapobiegania usunięciu katalogu",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Prefiks wskazujący, że wzorzec powinien być dopasowany bez rozróżniania wielkości liter",
|
||||
"Preview": "Podgląd",
|
||||
"Preview Usage Report": "Podgląd raportu użycia.",
|
||||
"Quick guide to supported patterns": "Krótki przewodnik po obsługiwanych wzorcach",
|
||||
@@ -167,7 +167,7 @@
|
||||
"Random": "Losowo",
|
||||
"Reduced by ignore patterns": "Ograniczono przez wzorce ignorowania",
|
||||
"Release Notes": "Informacje o wydaniu",
|
||||
"Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.",
|
||||
"Release candidates contain the latest features and fixes. They are similar to the traditional bi-weekly Syncthing releases.": "Wydania kandydujące zawierają najnowsze funkcje oraz poprawki błędów. Są one podobne do tradycyjnych co dwutygodniowych wydań Syncthing.",
|
||||
"Remote Devices": "Urządzenia zdalne",
|
||||
"Remove": "Usuń",
|
||||
"Required identifier for the folder. Must be the same on all cluster devices.": "Wymagany identyfikator dla folderu. Musi być taki sam na wszystkich urządzeniach.",
|
||||
@@ -204,8 +204,8 @@
|
||||
"Single level wildcard (matches within a directory only)": "Wieloznaczność na poziomie plików (uwzględnia nazwy plików)",
|
||||
"Smallest First": "Najmniejsze na początku",
|
||||
"Source Code": "Kod źródłowy",
|
||||
"Stable releases and release candidates": "Stable releases and release candidates",
|
||||
"Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.",
|
||||
"Stable releases and release candidates": "Wydania stabilne i wydania kandydujące",
|
||||
"Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "Wydania stabilne są opóźnione ok. dwa tygodnie. W tym czasie są testowane jako wydania kandydujące.",
|
||||
"Stable releases only": "Tylko stabilne wydania",
|
||||
"Staggered File Versioning": "Rozbudowane wersjonowanie pliku",
|
||||
"Start Browser": "Uruchom przeglądarkę",
|
||||
@@ -247,7 +247,7 @@
|
||||
"This Device": "To urządzenie",
|
||||
"This can easily give hackers access to read and change any files on your computer.": "Może to umożliwić osobom trzecim dostęp do odczytu i zmian dowolnych plików na urządzeniu.",
|
||||
"This is a major version upgrade.": "To jest ważna aktualizacja",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "This setting controls the free space required on the home (i.e., index database) disk.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "Te ustawienia kontrolują ilość potrzebnej wolnej przestrzeni na dysku domowym (np. indeksowanie bazy danych).",
|
||||
"Time": "Czas",
|
||||
"Trash Can File Versioning": "Kontrola werjsi plików w koszu",
|
||||
"Type": "Typ",
|
||||
@@ -261,7 +261,7 @@
|
||||
"Upgrading": "Aktualizowanie",
|
||||
"Upload Rate": "Prędkość wysyłania",
|
||||
"Uptime": "Czas działania",
|
||||
"Usage reporting is always enabled for candidate releases.": "Usage reporting is always enabled for candidate releases.",
|
||||
"Usage reporting is always enabled for candidate releases.": "Raportowanie użycia dla wydań kandydujących jest zawsze włączone.",
|
||||
"Use HTTPS for GUI": "Używaj HTTPS",
|
||||
"Version": "Wersja",
|
||||
"Versions Path": "Ścieżka wersji",
|
||||
@@ -273,8 +273,9 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Gdy dodajesz nowe urządzenie, pamiętaj że urządzenie musi zostać dodane także po drugiej stronie.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Przy dodawaniu nowego folderu, pamiętaj, że ID użyte jest do łączenia folderów pomiędzy urządzeniami. Wielkość liter ciągu ma znaczenie musi zgadzać się na wszystkich urządzeniach.",
|
||||
"Yes": "Tak",
|
||||
"You can change your choice at any time in the Settings dialog.": "Możesz zmienić swój wybór w dowolnej chwili w oknie Ustawień.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You can also select one of these nearby devices:": "Możesz również wybrać jedno z pobliskich urządzeń:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Możesz zmienić swój wybór w dowolnej chwili w Ustawieniach",
|
||||
"You can read more about the two release channels at the link below.": "Możesz więcej poczytać na temat obydwu wydań klikając poniższy link.",
|
||||
"You must keep at least one version.": "Musisz posiadać przynajmniej jedną wersję",
|
||||
"days": "dni",
|
||||
"directories": "katalogi",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Quando estiver adicionando um dispositivo, lembre-se de que este dispositivo deve ser adicionado do outro lado também.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Quando adicionar uma nova pasta, lembre-se que o ID da pasta é utilizado para ligar pastas entre dispositivos. Ele é sensível às diferenças entre maiúsculas e minúsculas e deve ser o mesmo em todos os dispositivos.",
|
||||
"Yes": "Sim",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Você pode mudar de ideia a qualquer momento na tela de configurações.",
|
||||
"You can read more about the two release channels at the link below.": "Você pode se informar melhor sobre os dois canais de lançamento no link abaixo.",
|
||||
"You must keep at least one version.": "Você deve manter pelo menos uma versão.",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"A device with that ID is already added.": "Já foi adicionado um dispositivo com esse ID anteriormente.lavelwildcard\n",
|
||||
"A device with that ID is already added.": "Já foi adicionado um dispositivo com esse ID anteriormente.",
|
||||
"A negative number of days doesn't make sense.": "Um número negativo de dias não faz sentido.",
|
||||
"A new major version may not be compatible with previous versions.": "Uma nova versão principal pode não ser compatível com versões anteriores.",
|
||||
"API Key": "Chave da API",
|
||||
@@ -136,7 +136,7 @@
|
||||
"Newest First": "Primeiro os mais recentes",
|
||||
"No": "Não",
|
||||
"No File Versioning": "Nenhuma",
|
||||
"No upgrades": "Não existem actualizações",
|
||||
"No upgrades": "Sem actualizações",
|
||||
"Normal": "Normal",
|
||||
"Notice": "Avisos",
|
||||
"OK": "OK",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Quando adicionar um novo dispositivo, lembre-se que este dispositivo tem que ser adicionado do outro lado também.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Quando adicionar uma nova pasta, lembre-se que o ID da pasta é utilizado para ligar as pastas entre dispositivos. É sensível às diferenças entre maiúsculas e minúsculas e tem que ter uma correspondência perfeita entre todos os dispositivos.",
|
||||
"Yes": "Sim",
|
||||
"You can also select one of these nearby devices:": "Também pode seleccionar um destes dispositivos que estão próximos:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Pode modificar a sua escolha em qualquer altura nas configurações.",
|
||||
"You can read more about the two release channels at the link below.": "Pode ler mais sobre os dois canais de lançamento na ligação abaixo.",
|
||||
"You must keep at least one version.": "Tem que manter pelo menos uma versão.",
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
"Advanced settings": "Дополнительные настройки",
|
||||
"All Data": "Все данные",
|
||||
"Allow Anonymous Usage Reporting?": "Разрешить анонимный отчет об использовании?",
|
||||
"Allowed Networks": "Allowed Networks",
|
||||
"Allowed Networks": "Разрешённые сети",
|
||||
"Alphabetic": "По алфавиту",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "An external command handles the versioning. It has to remove the file from the shared folder.",
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "Для версионирования используется внешняя программа. Ей нужно удалить файл из общей папки.",
|
||||
"An external command handles the versioning. It has to remove the file from the synced folder.": "Внешний процесс управляет версиями файлов. Процесс удалит файл из синхронизируемой папки.",
|
||||
"Anonymous Usage Reporting": "Анонимный отчет об использовании",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "Все устройства, подключённые к устройству-рекомендателю, будут добавлены к текущему устройству.",
|
||||
@@ -43,7 +43,7 @@
|
||||
"Copied from elsewhere": "Скопировано из другого места",
|
||||
"Copied from original": "Скопировано с оригинала",
|
||||
"Copyright © 2014-2016 the following Contributors:": "Авторские права © 2014–2016 принадлежат:",
|
||||
"Copyright © 2014-2017 the following Contributors:": "Авторское право © 2014-2017 следующие участники:",
|
||||
"Copyright © 2014-2017 the following Contributors:": "Авторские права © 2014—2017 следующие участники:",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "Creating ignore patterns, overwriting an existing file at {{path}}.",
|
||||
"Danger!": "Опасно!",
|
||||
"Deleted": "Удалено",
|
||||
@@ -65,23 +65,23 @@
|
||||
"Edit Device": "Редактирование устройства",
|
||||
"Edit Folder": "Редактирование папки",
|
||||
"Editing": "Редактирование",
|
||||
"Editing {%path%}.": "Editing {{path}}.",
|
||||
"Editing {%path%}.": "Правка {{path}}.",
|
||||
"Enable NAT traversal": "Включить NAT traversal",
|
||||
"Enable Relaying": "Включить релеи",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Enter a non-privileged port number (1024 - 65535).",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "Введите непривилегированный порт (1024—65535).",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "Введите через запятую («tcp://ip:port», «tcp://host:port») адреса, либо «dynamic», чтобы выполнить автоматическое обнаружение адреса.",
|
||||
"Enter ignore patterns, one per line.": "Введите шаблоны игнорирования, по одному на строку.",
|
||||
"Error": "Ошибка",
|
||||
"External File Versioning": "Внешний контроль версий файлов",
|
||||
"Failed Items": "Сбои",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Если нет IPv6-соединений, при подключении к IPv6-серверам произойдёт ошибка.",
|
||||
"File Pull Order": "Порядок получения файлов",
|
||||
"File Versioning": "Управление версиями",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "Права на файлы игнорируются при поиске изменений. Используется на файловой системе FAT.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Files are moved to .stversions directory when replaced or deleted by Syncthing.",
|
||||
"Files are moved to .stversions directory when replaced or deleted by Syncthing.": "Когда Syncthing изменяет или удаляет файлы, они помещаются в папку .stversions",
|
||||
"Files are moved to .stversions folder when replaced or deleted by Syncthing.": "Файлы перемещаются в папку .stversions после их замены или удаления системой Syncthing.",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.",
|
||||
"Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.": "Когда Syncthing изменяет или удаляет файлы, их версии с таймштампами помещаются в папку .stversions",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by Syncthing.": "Файлы с временнОй меткой версии помещаются в папку .stversions при их замене или удалении Syncthing.",
|
||||
"Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.": "Файлы защищены от изменений сделанных на других устройствах, но изменения сделанные на этом устройстве будут отправлены всему кластеру.",
|
||||
"Folder": "Папка",
|
||||
@@ -97,7 +97,7 @@
|
||||
"GUI Listen Addresses": "Адрес панели управления",
|
||||
"GUI Theme": "Тема оформления",
|
||||
"Generate": "Сгенерировать",
|
||||
"Global Changes": "Global Changes",
|
||||
"Global Changes": "Глобальные изменения",
|
||||
"Global Discovery": "Глобальное обнаружение",
|
||||
"Global Discovery Servers": "Серверы глобального обнаружения",
|
||||
"Global State": "Глобальное состояние",
|
||||
@@ -150,7 +150,7 @@
|
||||
"Override Changes": "Перезаписать изменения",
|
||||
"Path": "Путь",
|
||||
"Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Путь к папке на локальном компьютере. Если её не существует, то она будет создана. Тильда (~) может использоваться как сокращение для",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).": "Путь, в котором нужно хранить версии (оставьте пустым для папки по умолчанию .stversions внутри общей папки).",
|
||||
"Path where versions should be stored (leave empty for the default .stversions folder in the folder).": "Путь, где должны храниться версии (оставьте пустым, чтобы использовать папку по умолчанию .stversions внутри папки).",
|
||||
"Pause": "Пауза",
|
||||
"Pause All": "Приостановить все",
|
||||
@@ -247,7 +247,7 @@
|
||||
"This Device": "Это устройство",
|
||||
"This can easily give hackers access to read and change any files on your computer.": "Это может дать доступ хакерам для чтения и изменения любых файлов на вашем компьютере.",
|
||||
"This is a major version upgrade.": "Это обновление основной версии продукта.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "This setting controls the free space required on the home (i.e., index database) disk.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "Эта настройка управляет свободным местом, необходимым на домашнем диске (например, для базы индексов).",
|
||||
"Time": "Время",
|
||||
"Trash Can File Versioning": "Использовать версионность для файлов в Корзине",
|
||||
"Type": "Тип",
|
||||
@@ -266,13 +266,14 @@
|
||||
"Version": "Версия",
|
||||
"Versions Path": "Путь к версиям",
|
||||
"Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.": "Версии удаляются автоматически, если они существуют дольше максимального срока или превышают разрешённое количество файлов за интервал.",
|
||||
"Warning, this path is a parent directory of an existing folder \"{%otherFolder%}\".": "Warning, this path is a parent directory of an existing folder \"{{otherFolder}}\".",
|
||||
"Warning, this path is a parent directory of an existing folder \"{%otherFolderLabel%}\" ({%otherFolder%}).": "Warning, this path is a parent directory of an existing folder \"{{otherFolderLabel}}\" ({{otherFolder}}).",
|
||||
"Warning, this path is a parent directory of an existing folder \"{%otherFolder%}\".": "Внимание! Этот путь — родительская директория уже существующей папки «{{otherFolder}}».",
|
||||
"Warning, this path is a parent directory of an existing folder \"{%otherFolderLabel%}\" ({%otherFolder%}).": "Внимание! Этот путь — родительская директория уже существующей папки «{{otherFolderLabel}}» ({{otherFolder}}).",
|
||||
"Warning, this path is a subdirectory of an existing folder \"{%otherFolder%}\".": "Осторожно, этот путь является подкаталогом существующей папки «{{otherFolder}}».",
|
||||
"Warning, this path is a subdirectory of an existing folder \"{%otherFolderLabel%}\" ({%otherFolder%}).": "Warning, this path is a subdirectory of an existing folder \"{{otherFolderLabel}}\" ({{otherFolder}}).",
|
||||
"Warning, this path is a subdirectory of an existing folder \"{%otherFolderLabel%}\" ({%otherFolder%}).": "Внимание! Этот путь — поддиректория уже существующей папки «{{otherFolderLabel}}» ({{otherFolder}}).",
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Когда добавляете устройство, помните о том, что это же устройство должно быть добавлено и другой стороной.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Когда добавляете новую папку, помните, что ID папок используются для того, чтобы связывать папки между всеми устройствами. Они чувствительны к регистру и должны совпадать на всех используемых устройствах.",
|
||||
"Yes": "Да",
|
||||
"You can also select one of these nearby devices:": "Вы можете выбрать из этих устройств рядом:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Выбор можно изменить в любой момент в диалоге настроек.",
|
||||
"You can read more about the two release channels at the link below.": "О двух каналах выпусков можно почитать подробнее по нижеприведённой ссылке.",
|
||||
"You must keep at least one version.": "Вы должны хранить как минимум одну версию.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.",
|
||||
"Yes": "Áno",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Voľbu môžete kedykoľvek zmeniť v dialógu Nastavenia.",
|
||||
"You can read more about the two release channels at the link below.": "O dvoch vydávacích kanáloch si môžete viacej prečítať v odkaze nižšie.",
|
||||
"You must keep at least one version.": "Musíte ponechať aspoň jednu verziu",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "När du lägger till en ny enhet, kom ihåg att den här enheten måste läggas till på den andra enheten också.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "När du lägger till ny mapp, tänk på att mapp-ID knyter ihop mappar mellan olika enheter. De skiftlägeskänsliga och måste matcha precis mellan alla enheter.",
|
||||
"Yes": "Ja",
|
||||
"You can also select one of these nearby devices:": "Du kan också välja en av dessa närliggande enheter:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Du kan ändra ditt val när som helst i inställningsdialogrutan.",
|
||||
"You can read more about the two release channels at the link below.": "Du kan läsa mer om de två publiceringsskanalerna på länken nedan.",
|
||||
"You must keep at least one version.": "Du måste behålla åtminstone en version.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Yeni bir aygıt eklendiğinde, bu aygıtın karşı tarafa da eklenmesi gerektiğini unutmayın.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Yeni bir klasör eklendiğinde, Klasör ID'nin klasörleri aygıtlar arasında bağlantılandırmak için kullanıldığını unutmayın. Klasör ID'ler büyük - küçük harf duyarlıdır ve tüm aygıtlarda tamı tamına eşleşmelidir.",
|
||||
"Yes": "Evet",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Seçiminizi herhangi bir zamanda Ayarlar penceresinde değiştirebilirsiniz.",
|
||||
"You can read more about the two release channels at the link below.": "İki dağıtım kanalıyla ilgili daha çoğunu aşağıdaki bağlantıdan okuyabilirsiniz.",
|
||||
"You must keep at least one version.": "En az bir sürümü tutmalısınız.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Коли додаєте новий вузол, пам’ятайте, що цей вузол повинен бути доданий і на іншій стороні.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Коли додаєте нову директорію, пам’ятайте, що ID цієї директорії використовується для того, щоб зв’язувати директорії разом між пристроями. Назви повинні точно співпадати між усіма пристроями, регістр символів має значення.",
|
||||
"Yes": "Так",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "Ви завжди можете змінити свій вибір у Налаштуваннях.",
|
||||
"You can read more about the two release channels at the link below.": "Ви можете прочитати більше про два канали випусків за посиланням нижче.",
|
||||
"You must keep at least one version.": "Ви повинні зберігати щонайменше одну версію.",
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "Khi thêm một thiết bị mới, hãy nhớ rằng thiết bị này cũng phải được thêm vào máy kia.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "Khi thêm một thư mục mới, hãy nhớ rằng ID thư mục được dùng để gắn kết thư mục giữa các thiết bị với nhau. Chúng phải chính xác từng chữ, cả viết hoa và thường giữa tất cả thiết bị.",
|
||||
"Yes": "Phải",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
"You must keep at least one version.": "Bạn phải giữ ít nhất một phiên bản.",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"Add Device": "添加设备",
|
||||
"Add Folder": "添加文件夹",
|
||||
"Add Remote Device": "添加远程设备",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "添加介绍人中的设备到我们的设备列表,以互相共享文件夹。",
|
||||
"Add devices from the introducer to our device list, for mutually shared folders.": "将此新设备上拥有的“远程设备”都自动添加到您这边的“远程设备”列表中(如果它们跟您存在相同的文件夹的话)",
|
||||
"Add new folder?": "添加新文件夹?",
|
||||
"Address": "地址",
|
||||
"Addresses": "地址列表",
|
||||
@@ -24,15 +24,15 @@
|
||||
"An external command handles the versioning. It has to remove the file from the shared folder.": "使用外部命令接管版本控制。该命令必须自行从共享文件夹中删除该文件。",
|
||||
"An external command handles the versioning. It has to remove the file from the synced folder.": "使用外部命令接管版本控制。该命令必须自行从同步文件夹中删除该文件。",
|
||||
"Anonymous Usage Reporting": "匿名使用报告",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "在介绍人设备上被添加的其它设备,也将会被添加到本机。",
|
||||
"Any devices configured on an introducer device will be added to this device as well.": "在中介设备上添加的任何“远程设备”,也会被自动添加到本机的“远程设备”列表。",
|
||||
"Automatic upgrade now offers the choice between stable releases and release candidates.": "自动升级现提供了稳定版本和发布候选版之间的选择。",
|
||||
"Automatic upgrades": "自动升级",
|
||||
"Be careful!": "小心!",
|
||||
"Bugs": "问题回报",
|
||||
"CPU Utilization": "CPU使用率",
|
||||
"Changelog": "更新日志",
|
||||
"Clean out after": "在该时间后清除:",
|
||||
"Click to see discovery failures": "点击查看发现错误",
|
||||
"Clean out after": "在该时间后清除",
|
||||
"Click to see discovery failures": "点击查看设备发现错误",
|
||||
"Close": "关闭",
|
||||
"Command": "命令",
|
||||
"Comment, when used at the start of a line": "注释,在行首使用",
|
||||
@@ -55,27 +55,27 @@
|
||||
"Devices": "设备",
|
||||
"Disconnected": "连接已断开",
|
||||
"Discovered": "已发现",
|
||||
"Discovery": "发现",
|
||||
"Discovery Failures": "发现错误",
|
||||
"Discovery": "设备发现",
|
||||
"Discovery Failures": "设备发现错误",
|
||||
"Documentation": "文档",
|
||||
"Download Rate": "下载速度",
|
||||
"Downloaded": "已下载",
|
||||
"Downloading": "下载中",
|
||||
"Edit": "选项",
|
||||
"Edit Device": "编辑设备",
|
||||
"Edit Folder": "编辑文件夹",
|
||||
"Edit Device": "修改设备选项",
|
||||
"Edit Folder": "修改文件夹选项",
|
||||
"Editing": "正在编辑",
|
||||
"Editing {%path%}.": "正在编辑 {{path}}。",
|
||||
"Enable NAT traversal": "启用 NAT 遍历",
|
||||
"Enable Relaying": "开启中继",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "输入一个非负数(例如“2.35”)并选择单位。百分比是磁盘总大小的一部分。",
|
||||
"Enter a non-negative number (e.g., \"2.35\") and select a unit. Percentages are as part of the total disk size.": "输入一个非负数(例如“2.35”)并选择单位。%表示占磁盘总容量的百分比。",
|
||||
"Enter a non-privileged port number (1024 - 65535).": "输入一个非特权的端口号 (1024 - 65535)。",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "输入以半角逗号分隔的 (\"tcp://ip:port\", \"tcp://host:port\") 设置可用地址列表,或者输入 \"dynamic\" 表示自动发现地址。",
|
||||
"Enter comma separated (\"tcp://ip:port\", \"tcp://host:port\") addresses or \"dynamic\" to perform automatic discovery of the address.": "输入以半角逗号分隔的 (\"tcp://ip:port\", \"tcp://host:port\") 设备地址列表,或者输入 \"dynamic\" 以自动发现设备地址。",
|
||||
"Enter ignore patterns, one per line.": "请输入忽略表达式,每行一条。",
|
||||
"Error": "错误",
|
||||
"External File Versioning": "外部版本控制",
|
||||
"Failed Items": "失败的项目",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "如果无 IPv6 连接则预期连接到 IPv6 服务器会失败。",
|
||||
"Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "如果本机没有配置IPv6,则无法连接IPv6服务器是正常的。",
|
||||
"File Pull Order": "文件拉取顺序",
|
||||
"File Versioning": "版本控制",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT file systems.": "当查找文件更改时,忽略文件权限位。用在 FAT 文件系统上。",
|
||||
@@ -97,7 +97,7 @@
|
||||
"GUI Listen Addresses": "图形管理界面监听地址",
|
||||
"GUI Theme": "GUI 主题",
|
||||
"Generate": "生成",
|
||||
"Global Changes": "全局更改",
|
||||
"Global Changes": "全局变更",
|
||||
"Global Discovery": "全球发现",
|
||||
"Global Discovery Servers": "全球发现服务器",
|
||||
"Global State": "全局状态",
|
||||
@@ -109,9 +109,9 @@
|
||||
"Incoming Rate Limit (KiB/s)": "下载速率限制 (KiB/s)",
|
||||
"Incorrect configuration may damage your folder contents and render Syncthing inoperable.": "错误的配置可能损坏您文件夹内的内容,使得 Syncthing 无法工作。",
|
||||
"Introduced By": "介绍自",
|
||||
"Introducer": "介绍人设备",
|
||||
"Introducer": "作为中介",
|
||||
"Inversion of the given condition (i.e. do not exclude)": "对本条件取反(例如:不要排除某项)",
|
||||
"Keep Versions": "保留历史版本数量",
|
||||
"Keep Versions": "保留版本数量",
|
||||
"Largest First": "大文件优先",
|
||||
"Last File Received": "最后接收的文件",
|
||||
"Last Scan": "最后扫描",
|
||||
@@ -125,7 +125,7 @@
|
||||
"Local State (Total)": "本地状态汇总",
|
||||
"Major Upgrade": "重大更新",
|
||||
"Master": "自主",
|
||||
"Maximum Age": "历史版本最长保留时间",
|
||||
"Maximum Age": "最长保留时间",
|
||||
"Metadata Only": "仅元数据",
|
||||
"Minimum Free Disk Space": "最低可用磁盘空间",
|
||||
"Move to top of queue": "移动到队列顶端",
|
||||
@@ -158,8 +158,8 @@
|
||||
"Please consult the release notes before performing a major upgrade.": "请在进行重大更新前查看发布说明。",
|
||||
"Please set a GUI Authentication User and Password in the Settings dialog.": "请在设置对话框中设置 GUI 验证用户及其密码。",
|
||||
"Please wait": "请稍候",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "Prefix indicating that the file can be deleted if preventing directory removal",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "Prefix indicating that the pattern should be matched without case sensitivity",
|
||||
"Prefix indicating that the file can be deleted if preventing directory removal": "表示如果删除了阻止目录则文件可被删除的前缀",
|
||||
"Prefix indicating that the pattern should be matched without case sensitivity": "表示该模式匹配忽略了大小写差异的前缀",
|
||||
"Preview": "预览",
|
||||
"Preview Usage Report": "预览使用报告",
|
||||
"Quick guide to supported patterns": "支持的通配符的简单教程:",
|
||||
@@ -273,6 +273,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "若您在本机添加新设备,记住您也必须在这个设备上添加本机。",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "若你添加了新文件夹,记住文件夹 ID 是用以在不同设备间建立联系的。在不同设备间拥有相同 ID 的文件夹将会被同步。且文件夹 ID 区分大小写。",
|
||||
"Yes": "是",
|
||||
"You can also select one of these nearby devices:": "您也可以从这些附近的设备中选择:",
|
||||
"You can change your choice at any time in the Settings dialog.": "您可以在任何时候在设置对话框中更改选择。",
|
||||
"You can read more about the two release channels at the link below.": "您可以从以下链接读取更多关于两个发行渠道的信息。",
|
||||
"You must keep at least one version.": "您必须保留至少一个版本。",
|
||||
|
||||
@@ -9,32 +9,32 @@
|
||||
-->
|
||||
<html lang="en" ng-app="syncthing" ng-controller="SyncthingController" class="ng-cloak">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<link rel="shortcut icon" href="assets/img/favicon-{{syncthingStatus()}}.png">
|
||||
<link rel="mask-icon" href="assets/img/safari-pinned-tab.svg" color="#0882c8">
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
<link rel="shortcut icon" href="assets/img/favicon-{{syncthingStatus()}}.png"/>
|
||||
<link rel="mask-icon" href="assets/img/safari-pinned-tab.svg" color="#0882c8"/>
|
||||
|
||||
<title ng-bind="thisDeviceName() + ' | Syncthing'"></title>
|
||||
<link href="vendor/bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="assets/font/raleway.css" rel="stylesheet">
|
||||
<link href="vendor/font-awesome/css/font-awesome.css" rel="stylesheet">
|
||||
<link href="assets/css/overrides.css" rel="stylesheet">
|
||||
<link href="assets/css/theme.css" rel="stylesheet">
|
||||
<link href="vendor/bootstrap/css/bootstrap.css" rel="stylesheet"/>
|
||||
<link href="assets/font/raleway.css" rel="stylesheet"/>
|
||||
<link href="vendor/font-awesome/css/font-awesome.css" rel="stylesheet"/>
|
||||
<link href="assets/css/overrides.css" rel="stylesheet"/>
|
||||
<link href="assets/css/theme.css" rel="stylesheet"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script src="syncthing/development/logbar.js"></script>
|
||||
<script type="text/javascript" src="syncthing/development/logbar.js"></script>
|
||||
<div ng-if="version.isDevelopmentVersion" ng-include="'syncthing/development/logbar.html'"></div>
|
||||
<!-- Top bar -->
|
||||
|
||||
<nav class="navbar navbar-top navbar-default" role="navigation">
|
||||
<div class="container">
|
||||
<span class="navbar-brand" aria-hidden="true">
|
||||
<img class="logo hidden-xs" src="assets/img/logo-horizontal.svg" height="32" width="117"/>
|
||||
<img class="logo hidden visible-xs" src="assets/img/favicon-default.png" height="32"/>
|
||||
<img class="logo hidden-xs" src="assets/img/logo-horizontal.svg" height="32" width="117" alt=""/>
|
||||
<img class="logo hidden visible-xs" src="assets/img/favicon-default.png" height="32" alt=""/>
|
||||
</span>
|
||||
<p class="navbar-text hidden-xs" ng-class="{'hidden-sm':upgradeInfo && upgradeInfo.newer}">{{thisDeviceName()}}</p>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
@@ -394,7 +394,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fa fa-fw fa-share-alt"></span> <span translate>Shared With</span></th>
|
||||
<td class="text-right">{{sharesFolder(folder)}}</td>
|
||||
<td class="text-right" title="{{sharesFolder(folder)}}">{{sharesFolder(folder)}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fa fa-fw fa-clock-o"></span> <span translate>Last Scan</span></th>
|
||||
@@ -564,7 +564,7 @@
|
||||
<span ng-switch="deviceStatus(deviceCfg)" class="pull-right text-{{deviceClass(deviceCfg)}}">
|
||||
<span ng-switch-when="insync"><span class="hidden-xs" translate>Up to Date</span><span class="visible-xs">◼</span></span>
|
||||
<span ng-switch-when="syncing">
|
||||
<span class="hidden-xs" translate>Syncing</span> ({{completion[deviceCfg.deviceID]._total | number:0}}%)
|
||||
<span class="hidden-xs" translate>Syncing</span> ({{completion[deviceCfg.deviceID]._total | number:0}}%, {{completion[deviceCfg.deviceID]._needBytes | binary}}B)
|
||||
</span>
|
||||
<span ng-switch-when="paused"><span class="hidden-xs" translate>Paused</span><span class="visible-xs">◼</span></span>
|
||||
<span ng-switch-when="disconnected"><span class="hidden-xs" translate>Disconnected</span><span class="visible-xs">◼</span></span>
|
||||
@@ -645,7 +645,7 @@
|
||||
</tr>
|
||||
<tr ng-if="deviceFolders(deviceCfg).length > 0">
|
||||
<th><span class="fa fa-fw fa-folder"></span> <span translate>Folders</span></th>
|
||||
<td class="text-right">{{deviceFolders(deviceCfg).map(folderLabel).join(", ")}}</td>
|
||||
<td class="text-right" title="{{deviceFolders(deviceCfg).map(folderLabel).join(", ")}}">{{deviceFolders(deviceCfg).map(folderLabel).join(", ")}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -721,41 +721,41 @@
|
||||
<ng-include src="'syncthing/core/discoveryFailuresModalView.html'"></ng-include>
|
||||
|
||||
<!-- vendor scripts -->
|
||||
<script src="vendor/jquery/jquery-2.2.2.js"></script>
|
||||
<script src="vendor/angular/angular.js"></script>
|
||||
<script src="vendor/angular/angular-sanitize.js"></script>
|
||||
<script src="vendor/angular/angular-translate.js"></script>
|
||||
<script src="vendor/angular/angular-translate-loader-static-files.js"></script>
|
||||
<script src="vendor/angular/angular-dirPagination.js"></script>
|
||||
<script src="vendor/bootstrap/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="vendor/jquery/jquery-2.2.2.js"></script>
|
||||
<script type="text/javascript" src="vendor/angular/angular.js"></script>
|
||||
<script type="text/javascript" src="vendor/angular/angular-sanitize.js"></script>
|
||||
<script type="text/javascript" src="vendor/angular/angular-translate.js"></script>
|
||||
<script type="text/javascript" src="vendor/angular/angular-translate-loader-static-files.js"></script>
|
||||
<script type="text/javascript" src="vendor/angular/angular-dirPagination.js"></script>
|
||||
<script type="text/javascript" src="vendor/bootstrap/js/bootstrap.js"></script>
|
||||
<!-- / vendor scripts -->
|
||||
|
||||
<!-- gui application code -->
|
||||
<script src="syncthing/core/module.js"></script>
|
||||
<script src="syncthing/core/alwaysNumberFilter.js"></script>
|
||||
<script src="syncthing/core/basenameFilter.js"></script>
|
||||
<script src="syncthing/core/binaryFilter.js"></script>
|
||||
<script src="syncthing/core/durationFilter.js"></script>
|
||||
<script src="syncthing/core/eventService.js"></script>
|
||||
<script src="syncthing/core/identiconDirective.js"></script>
|
||||
<script src="syncthing/core/languageSelectDirective.js"></script>
|
||||
<script src="syncthing/core/lastErrorComponentFilter.js"></script>
|
||||
<script src="syncthing/core/localeService.js"></script>
|
||||
<script src="syncthing/core/modalDirective.js"></script>
|
||||
<script src="syncthing/core/naturalFilter.js"></script>
|
||||
<script src="syncthing/core/metricFilter.js"></script>
|
||||
<script src="syncthing/core/notificationDirective.js"></script>
|
||||
<script src="syncthing/core/pathIsSubDirDirective.js"></script>
|
||||
<script src="syncthing/core/popoverDirective.js"></script>
|
||||
<script src="syncthing/core/selectOnClickDirective.js"></script>
|
||||
<script src="syncthing/core/syncthingController.js"></script>
|
||||
<script src="syncthing/core/tooltipDirective.js"></script>
|
||||
<script src="syncthing/core/uniqueFolderDirective.js"></script>
|
||||
<script src="syncthing/core/validDeviceidDirective.js"></script>
|
||||
<script src="assets/lang/valid-langs.js"></script>
|
||||
<script src="assets/lang/prettyprint.js"></script>
|
||||
<script src="meta.js"></script>
|
||||
<script src="syncthing/app.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/module.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/alwaysNumberFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/basenameFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/binaryFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/durationFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/eventService.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/identiconDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/languageSelectDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/lastErrorComponentFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/localeService.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/modalDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/naturalFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/metricFilter.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/notificationDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/pathIsSubDirDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/popoverDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/selectOnClickDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/syncthingController.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/tooltipDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/uniqueFolderDirective.js"></script>
|
||||
<script type="text/javascript" src="syncthing/core/validDeviceidDirective.js"></script>
|
||||
<script type="text/javascript" src="assets/lang/valid-langs.js"></script>
|
||||
<script type="text/javascript" src="assets/lang/prettyprint.js"></script>
|
||||
<script type="text/javascript" src="meta.js"></script>
|
||||
<script type="text/javascript" src="syncthing/app.js"></script>
|
||||
<!-- / gui application code -->
|
||||
|
||||
</body>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<p translate>Copyright © 2014-2017 the following Contributors:</p>
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="contributor-list">
|
||||
Jakob Borg, Audrius Butkevicius, Alexander Graf, Anderson Mesquita, Antony Male, Ben Schulz, Caleb Callaway, Daniel Harte, Lars K.W. Gohlke, Lode Hoste, Michael Ploujnikov, Nate Morrison, Philippe Schommers, Ryan Sullivan, Sergey Mishin, Simon Frei, Stefan Tatschner, Aaron Bieber, Adam Piggott, Adel Qalieh, Alessandro G., Alexandre Viau, Andrew Dunham, Andrey D, Antoine Lamielle, Arthur Axel fREW Schmidt, Bart De Vries, Ben Curthoys, Ben Shepherd, Ben Sidhom, Benny Ng, Brandon Philips, Brendan Long, Brian R. Becker, Carsten Hagemann, Cathryne Linenweaver, Cedric Staniewski, Chris Howie, Chris Joel, Colin Kennedy, Daniel Bergmann, Daniel Martí, Darshil Chanpura, David Rimmer, Denis A., Dennis Wilson, Dominik Heidler, Elias Jarlebring, Emil Hessman, Erik Meitner, Federico Castagnini, Felix Ableitner, Felix Unterpaintner, Francois-Xavier Gsell, Frank Isemann, Gilli Sigurdsson, Heiko Zuerker, Jaakko Hannikainen, Jacek Szafarkiewicz, Jake Peterson, James Patterson, Jaroslav Malec, Jaya Chithra, Jens Diemer, Jochen Voss, Johan Vromans, Karol Różycki, Kelong Cong, Ken'ichi Kamada, Kevin Allen, Kevin White, Jr., Kurt Fitzner, Laurent Etiemble, Leo Arias, Lord Landon Agahnim, Majed Abdulaziz, Marc Laporte, Marc Pujol, Marcin Dziadus, Mark Pulford, Mateusz Naściszewski, Matt Burke, Max Schulze, Michael Jephcote, Michael Tilli, Niels Peter Roest, Pascal Jungblut, Peter Hoeg, Phill Luby, Piotr Bejda, Robert Carosi, Roman Zaynetdinov, Sacheendra Talluri, Scott Klupfel, Stefan Kuntz, Suhas Gundimeda, Tim Abell, Tim Howes, Tobias Nygren, Tomas Cerveny, Tully Robinson, Tyler Brazier, Unrud, Veeti Paananen, Victor Buinsky, Vil Brekin, William A. Kennington III, Wulf Weich, Xavier O., Yannic A.
|
||||
Jakob Borg, Audrius Butkevicius, Alexander Graf, Anderson Mesquita, Antony Male, Ben Schulz, Caleb Callaway, Daniel Harte, Lars K.W. Gohlke, Lode Hoste, Michael Ploujnikov, Nate Morrison, Philippe Schommers, Ryan Sullivan, Sergey Mishin, Simon Frei, Stefan Tatschner, Aaron Bieber, Adam Piggott, Adel Qalieh, Alessandro G., Alexandre Viau, Andrew Dunham, Andrey D, Antoine Lamielle, Arthur Axel fREW Schmidt, Bart De Vries, Ben Curthoys, Ben Shepherd, Ben Sidhom, Benny Ng, Brandon Philips, Brendan Long, Brian R. Becker, Carsten Hagemann, Cathryne Linenweaver, Cedric Staniewski, Chris Howie, Chris Joel, Colin Kennedy, Daniel Bergmann, Daniel Martí, Darshil Chanpura, David Rimmer, Denis A., Dennis Wilson, Dominik Heidler, Elias Jarlebring, Emil Hessman, Erik Meitner, Federico Castagnini, Felix Ableitner, Felix Unterpaintner, Francois-Xavier Gsell, Frank Isemann, Gilli Sigurdsson, Heiko Zuerker, Jaakko Hannikainen, Jacek Szafarkiewicz, Jake Peterson, James Patterson, Jaroslav Malec, Jaya Chithra, Jens Diemer, Jochen Voss, Johan Vromans, Jose Manuel Delicado, Karol Różycki, Kelong Cong, Ken'ichi Kamada, Kevin Allen, Kevin White, Jr., Kurt Fitzner, Laurent Etiemble, Leo Arias, Liu Siyuan, Lord Landon Agahnim, Majed Abdulaziz, Marc Laporte, Marc Pujol, Marcin Dziadus, Mark Pulford, Mateusz Naściszewski, Matt Burke, Max Schulze, Michael Jephcote, Michael Tilli, Niels Peter Roest, Pascal Jungblut, Peter Hoeg, Phill Luby, Piotr Bejda, Robert Carosi, Roman Zaynetdinov, Ross Smith II, Sacheendra Talluri, Scott Klupfel, Stefan Kuntz, Suhas Gundimeda, Tim Abell, Tim Howes, Tobias Nygren, Tomas Cerveny, Tully Robinson, Tyler Brazier, Unrud, Veeti Paananen, Victor Buinsky, Vil Brekin, William A. Kennington III, Wulf Weich, Xavier O., Yannic A.
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
@@ -40,4 +40,4 @@
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
</notification>
|
||||
|
||||
@@ -74,7 +74,8 @@ angular.module('syncthing.core')
|
||||
staggeredCleanInterval: 3600,
|
||||
staggeredVersionsPath: "",
|
||||
externalCommand: "",
|
||||
autoNormalize: true
|
||||
autoNormalize: true,
|
||||
path: ""
|
||||
};
|
||||
|
||||
$scope.localStateTotal = {
|
||||
@@ -232,7 +233,8 @@ angular.module('syncthing.core')
|
||||
address: arg.data.addr
|
||||
};
|
||||
$scope.completion[arg.data.id] = {
|
||||
_total: 100
|
||||
_total: 100,
|
||||
_needBytes: 0
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -378,7 +380,8 @@ angular.module('syncthing.core')
|
||||
$scope.devices = $scope.config.devices;
|
||||
$scope.devices.forEach(function (deviceCfg) {
|
||||
$scope.completion[deviceCfg.deviceID] = {
|
||||
_total: 100
|
||||
_total: 100,
|
||||
_needBytes: 0
|
||||
};
|
||||
});
|
||||
$scope.devices.sort(deviceCompare);
|
||||
@@ -463,7 +466,7 @@ angular.module('syncthing.core')
|
||||
function recalcCompletion(device) {
|
||||
var total = 0, needed = 0, deletes = 0;
|
||||
for (var folder in $scope.completion[device]) {
|
||||
if (folder === "_total") {
|
||||
if (folder === "_total" || folder === '_needBytes') {
|
||||
continue;
|
||||
}
|
||||
total += $scope.completion[device][folder].globalBytes;
|
||||
@@ -472,8 +475,10 @@ angular.module('syncthing.core')
|
||||
}
|
||||
if (total == 0) {
|
||||
$scope.completion[device]._total = 100;
|
||||
$scope.completion[device]._needBytes = 0;
|
||||
} else {
|
||||
$scope.completion[device]._total = 100 * (1 - needed / total);
|
||||
$scope.completion[device]._total = Math.floor(100 * (1 - needed / total));
|
||||
$scope.completion[device]._needBytes = needed
|
||||
}
|
||||
|
||||
if (needed == 0 && deletes > 0) {
|
||||
@@ -481,6 +486,7 @@ angular.module('syncthing.core')
|
||||
// to do. Drop down the completion percentage to indicate
|
||||
// that we have stuff to do.
|
||||
$scope.completion[device]._total = 95;
|
||||
$scope.completion[device]._needBytes = 0;
|
||||
}
|
||||
|
||||
console.log("recalcCompletion", device, $scope.completion[device]);
|
||||
@@ -601,6 +607,25 @@ angular.module('syncthing.core')
|
||||
$scope.neededTotal = data.total;
|
||||
}
|
||||
|
||||
function pathJoin(base, name) {
|
||||
base = expandTilde(base);
|
||||
if (base[base.length - 1] !== $scope.system.pathSeparator) {
|
||||
return base + $scope.system.pathSeparator + name;
|
||||
}
|
||||
return base + name;
|
||||
}
|
||||
|
||||
function expandTilde(path) {
|
||||
if (path && path.trim().charAt(0) === '~') {
|
||||
return $scope.system.tilde + path.trim().substring(1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
function shouldSetDefaultFolderPath() {
|
||||
return $scope.config.options && $scope.config.options.defaultFolderPath && !$scope.editingExisting && $scope.folderEditor.folderPath.$pristine
|
||||
}
|
||||
|
||||
$scope.neededPageChanged = function (page) {
|
||||
$scope.neededCurrentPage = page;
|
||||
refreshNeed($scope.neededFolder);
|
||||
@@ -1185,7 +1210,19 @@ angular.module('syncthing.core')
|
||||
$scope.addDevice = function (deviceID, name) {
|
||||
return $http.get(urlbase + '/system/discovery')
|
||||
.success(function (registry) {
|
||||
$scope.discovery = registry;
|
||||
$scope.discovery = [];
|
||||
outer:
|
||||
for (var id in registry) {
|
||||
if ($scope.discovery.length === 5) {
|
||||
break;
|
||||
}
|
||||
for (var i = 0; i < $scope.devices.length; i++) {
|
||||
if ($scope.devices[i].deviceID === id) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
$scope.discovery.push(id);
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
$scope.currentDevice = {
|
||||
@@ -1343,9 +1380,10 @@ angular.module('syncthing.core')
|
||||
$scope.directoryList = [];
|
||||
|
||||
$scope.$watch('currentFolder.path', function (newvalue) {
|
||||
if (newvalue && newvalue.trim().charAt(0) === '~') {
|
||||
$scope.currentFolder.path = $scope.system.tilde + newvalue.trim().substring(1);
|
||||
if (!newvalue) {
|
||||
return;
|
||||
}
|
||||
$scope.currentFolder.path = expandTilde(newvalue);
|
||||
$http.get(urlbase + '/system/browse', {
|
||||
params: { current: newvalue }
|
||||
}).success(function (data) {
|
||||
@@ -1353,6 +1391,20 @@ angular.module('syncthing.core')
|
||||
}).error($scope.emitHTTPError);
|
||||
});
|
||||
|
||||
$scope.$watch('currentFolder.label', function (newvalue) {
|
||||
if (!newvalue || !shouldSetDefaultFolderPath()) {
|
||||
return;
|
||||
}
|
||||
$scope.currentFolder.path = pathJoin($scope.config.options.defaultFolderPath, newvalue);
|
||||
});
|
||||
|
||||
$scope.$watch('currentFolder.id', function (newvalue) {
|
||||
if (!newvalue || !shouldSetDefaultFolderPath() || $scope.currentFolder.label) {
|
||||
return;
|
||||
}
|
||||
$scope.currentFolder.path = pathJoin($scope.config.options.defaultFolderPath, newvalue);
|
||||
});
|
||||
|
||||
$scope.loadFormIntoScope = function (form) {
|
||||
console.log('loadFormIntoScope',form.$name);
|
||||
switch (form.$name) {
|
||||
@@ -1377,6 +1429,7 @@ angular.module('syncthing.core')
|
||||
};
|
||||
|
||||
$scope.editFolder = function (folderCfg) {
|
||||
$scope.editingExisting = true;
|
||||
$scope.currentFolder = angular.copy(folderCfg);
|
||||
if ($scope.currentFolder.path.slice(-1) === $scope.system.pathSeparator) {
|
||||
$scope.currentFolder.path = $scope.currentFolder.path.slice(0, -1);
|
||||
@@ -1419,21 +1472,21 @@ angular.module('syncthing.core')
|
||||
}
|
||||
$scope.currentFolder.externalCommand = $scope.currentFolder.externalCommand || "";
|
||||
|
||||
$scope.editingExisting = true;
|
||||
$scope.editFolderModal();
|
||||
};
|
||||
|
||||
$scope.addFolder = function () {
|
||||
$http.get(urlbase + '/svc/random/string?length=10').success(function (data) {
|
||||
$scope.editingExisting = false;
|
||||
$scope.currentFolder = angular.copy($scope.folderDefaults);
|
||||
$scope.currentFolder.id = (data.random.substr(0, 5) + '-' + data.random.substr(5, 5)).toLowerCase();
|
||||
$scope.editingExisting = false;
|
||||
$scope.editFolderModal();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addFolderAndShare = function (folder, folderLabel, device) {
|
||||
$scope.dismissFolderRejection(folder, device);
|
||||
$scope.editingExisting = false;
|
||||
$scope.currentFolder = angular.copy($scope.folderDefaults);
|
||||
$scope.currentFolder.id = folder;
|
||||
$scope.currentFolder.label = folderLabel;
|
||||
@@ -1442,7 +1495,6 @@ angular.module('syncthing.core')
|
||||
};
|
||||
$scope.currentFolder.selectedDevices[device] = true;
|
||||
|
||||
$scope.editingExisting = false;
|
||||
$scope.editFolderModal();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="dev-top-bar" id="dev-top-bar" style="display: none">
|
||||
<link href="assets/css/dev.css" rel="stylesheet">
|
||||
<link href="assets/css/dev.css" rel="stylesheet"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-4"><b>DEV</b></div>
|
||||
<div id="log" class="col-xs-8">
|
||||
|
||||
@@ -3,22 +3,30 @@
|
||||
<form role="form" name="deviceEditor">
|
||||
<div class="form-group" ng-class="{'has-error': deviceEditor.deviceID.$invalid && deviceEditor.deviceID.$dirty}" ng-init="loadFormIntoScope(deviceEditor)">
|
||||
<label translate for="deviceID">Device ID</label>
|
||||
<input ng-if="!editingExisting" name="deviceID" id="deviceID" class="form-control text-monospace" type="text" ng-model="currentDevice.deviceID" required valid-deviceid list="discovery-list" />
|
||||
<datalist id="discovery-list" ng-if="!editingExisting">
|
||||
<option ng-repeat="(id, data) in discovery" value="{{id}}" />
|
||||
</datalist>
|
||||
<div ng-if="!editingExisting">
|
||||
<input name="deviceID" id="deviceID" class="form-control text-monospace" type="text" ng-model="currentDevice.deviceID" required="" valid-deviceid list="discovery-list" aria-required="true"/>
|
||||
<datalist id="discovery-list">
|
||||
<option ng-repeat="id in discovery" value="{{id}}" />
|
||||
</datalist>
|
||||
<p class="help-block" ng-if="discovery">
|
||||
<span translate>You can also select one of these nearby devices:</span>
|
||||
<ul>
|
||||
<li ng-repeat="id in discovery"><a ng-click="currentDevice.deviceID = id">{{id}}</a></li>
|
||||
</ul>
|
||||
</p>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="deviceEditor.deviceID.$valid || deviceEditor.deviceID.$pristine">The device ID to enter here can be found in the "Actions > Show ID" dialog on the other device. Spaces and dashes are optional (ignored).</span>
|
||||
<span translate ng-show="deviceEditor.deviceID.$valid || deviceEditor.deviceID.$pristine">When adding a new device, keep in mind that this device must be added on the other side too.</span>
|
||||
<span translate ng-if="deviceEditor.deviceID.$error.required && deviceEditor.deviceID.$dirty">The device ID cannot be blank.</span>
|
||||
<span translate ng-if="deviceEditor.deviceID.$error.validDeviceid && deviceEditor.deviceID.$dirty">The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional.</span>
|
||||
<span translate ng-if="deviceEditor.deviceID.$error.unique && deviceEditor.deviceID.$dirty">A device with that ID is already added.</span>
|
||||
</p>
|
||||
</div>
|
||||
<div ng-if="editingExisting" class="well well-sm text-monospace" select-on-click>{{currentDevice.deviceID}}</div>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="deviceEditor.deviceID.$valid || deviceEditor.deviceID.$pristine">The device ID to enter here can be found in the "Actions > Show ID" dialog on the other device. Spaces and dashes are optional (ignored).</span>
|
||||
<span translate ng-show="!editingExisting && (deviceEditor.deviceID.$valid || deviceEditor.deviceID.$pristine)">When adding a new device, keep in mind that this device must be added on the other side too.</span>
|
||||
<span translate ng-if="deviceEditor.deviceID.$error.required && deviceEditor.deviceID.$dirty">The device ID cannot be blank.</span>
|
||||
<span translate ng-if="deviceEditor.deviceID.$error.validDeviceid && deviceEditor.deviceID.$dirty">The entered device ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional.</span>
|
||||
<span translate ng-if="deviceEditor.deviceID.$error.unique && deviceEditor.deviceID.$dirty">A device with that ID is already added.</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label translate for="name">Device Name</label>
|
||||
<input id="name" class="form-control" type="text" ng-model="currentDevice.name"></input>
|
||||
<input id="name" class="form-control" type="text" ng-model="currentDevice.name" />
|
||||
<p translate ng-if="currentDevice.deviceID == myID" class="help-block">Shown instead of Device ID in the cluster status. Will be advertised to other devices as an optional default name.</p>
|
||||
<p translate ng-if="currentDevice.deviceID != myID" class="help-block">Shown instead of Device ID in the cluster status. Will be updated to the name the device advertises if left empty.</p>
|
||||
</div>
|
||||
|
||||
@@ -2,21 +2,25 @@
|
||||
<modal id="globalChanges" status="default" icon="{{'history'}}" heading="{{'Global Changes' | translate}}" large="yes" closeable="yes">
|
||||
<div class="modal-body">
|
||||
<table>
|
||||
<tr>
|
||||
<th translate>Device</th>
|
||||
<th translate>Action</th>
|
||||
<th translate>Type</th>
|
||||
<th translate>Path</th>
|
||||
<th translate>Time</th>
|
||||
</tr>
|
||||
<tr ng-repeat="changeEvent in globalChangeEvents">
|
||||
<td ng-if="changeEvent.data.modifiedBy">{{friendlyNameFromShort(changeEvent.data.modifiedBy)}}</td>
|
||||
<td ng-if="!changeEvent.data.modifiedBy"><span translate>Unknown</span></td>
|
||||
<td>{{changeEvent.data.action}}</td>
|
||||
<td>{{changeEvent.data.type}}</td>
|
||||
<td class="globalChanges-path-col">{{changeEvent.data.path}}</td>
|
||||
<td class="globalChanges-time-col">{{changeEvent.time | date:"yyyy-MM-dd HH:mm:ss"}}</td>
|
||||
</tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th translate>Device</th>
|
||||
<th translate>Action</th>
|
||||
<th translate>Type</th>
|
||||
<th translate>Path</th>
|
||||
<th translate>Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="changeEvent in globalChangeEvents">
|
||||
<td ng-if="changeEvent.data.modifiedBy">{{friendlyNameFromShort(changeEvent.data.modifiedBy)}}</td>
|
||||
<td ng-if="!changeEvent.data.modifiedBy"><span translate>Unknown</span></td>
|
||||
<td>{{changeEvent.data.action}}</td>
|
||||
<td>{{changeEvent.data.type}}</td>
|
||||
<td class="globalChanges-path-col">{{changeEvent.data.path}}</td>
|
||||
<td class="globalChanges-time-col">{{changeEvent.time | date:"yyyy-MM-dd HH:mm:ss"}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<modal id="idqr" status="info" icon="qrcode" heading="{{'Device Identification' | translate}} - {{deviceName(currentDevice)}}" large="yes" closeable="yes">
|
||||
<div class="modal-body">
|
||||
<div class="well well-sm text-monospace text-center" select-on-click>{{currentDevice.deviceID}}</div>
|
||||
<img ng-if="currentDevice.deviceID" class="center-block img-thumbnail" ng-src="qr/?text={{currentDevice.deviceID}}"/>
|
||||
<img ng-if="currentDevice.deviceID" class="center-block img-thumbnail" ng-src="qr/?text={{currentDevice.deviceID}}" alt="qr code"/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': folderEditor.folderID.$invalid && folderEditor.folderID.$dirty}">
|
||||
<label for="folderID"><span translate>Folder ID</span></label>
|
||||
<input name="folderID" ng-readonly="editingExisting || (!editingExisting && currentFolder.viewFlags.importFromOtherDevice)" id="folderID" class="form-control" type="text" ng-model="currentFolder.id" required unique-folder value="{{currentFolder.id}}"/>
|
||||
<input name="folderID" ng-readonly="editingExisting || (!editingExisting && currentFolder.viewFlags.importFromOtherDevice)" id="folderID" class="form-control" type="text" ng-model="currentFolder.id" required="" aria-required="true" unique-folder value="{{currentFolder.id}}"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="folderEditor.folderID.$valid || folderEditor.folderID.$pristine">Required identifier for the folder. Must be the same on all cluster devices.</span>
|
||||
<span translate ng-if="folderEditor.folderID.$error.uniqueFolder">The folder ID must be unique.</span>
|
||||
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': folderEditor.folderPath.$invalid && folderEditor.folderPath.$dirty}">
|
||||
<label translate for="folderPath">Folder Path</label>
|
||||
<input name="folderPath" ng-readonly="editingExisting" id="folderPath" class="form-control" type="text" ng-model="currentFolder.path" list="directory-list" required path-is-sub-dir/>
|
||||
<input name="folderPath" ng-readonly="editingExisting" id="folderPath" class="form-control" type="text" ng-model="currentFolder.path" list="directory-list" required="" aria-required="true" path-is-sub-dir/>
|
||||
<datalist id="directory-list">
|
||||
<option ng-repeat="directory in directoryList" value="{{ directory }}" />
|
||||
</datalist>
|
||||
@@ -45,7 +45,7 @@
|
||||
<div class="col-md-4" ng-repeat="device in otherDevices()">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" ng-model="currentFolder.selectedDevices[device.deviceID]"> {{deviceName(device)}}
|
||||
<input type="checkbox" ng-model="currentFolder.selectedDevices[device.deviceID]"/> {{deviceName(device)}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,7 +68,7 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" ng-class="{'has-error': folderEditor.rescanIntervalS.$invalid && folderEditor.rescanIntervalS.$dirty}">
|
||||
<label for="rescanIntervalS"><span translate>Rescan Interval</span> (s)</label><br/>
|
||||
<input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentFolder.rescanIntervalS" required min="0">
|
||||
<input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentFolder.rescanIntervalS" required="" aria-required="true" min="0"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="!folderEditor.rescanIntervalS.$valid && folderEditor.rescanIntervalS.$dirty">The rescan interval must be a non-negative number of seconds.</span>
|
||||
</p>
|
||||
@@ -77,7 +77,7 @@
|
||||
<div class="col-md-6 form-horizontal">
|
||||
<div class="form-group" ng-class="{'has-error': folderEditor.minDiskFree.$invalid && folderEditor.minDiskFree.$dirty}">
|
||||
<label class="col-xs-12" for="minDiskFree"><span translate>Minimum Free Disk Space</span></label><br/>
|
||||
<div class="col-xs-9"><input name="minDiskFree" id="minDiskFree" class="form-control" type="number" ng-model="currentFolder.minDiskFree.value" required min="0" step="0.01"></div>
|
||||
<div class="col-xs-9"><input name="minDiskFree" id="minDiskFree" class="form-control" type="number" ng-model="currentFolder.minDiskFree.value" required="" aria-required="true" min="0" step="0.01"/></div>
|
||||
<div class="col-xs-3"><select class="col-sm-3 form-control" ng-model="currentFolder.minDiskFree.unit">
|
||||
<option value="%">%</option>
|
||||
<option value="kB">kB</option>
|
||||
@@ -106,7 +106,7 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" ng-model="currentFolder.ignorePerms"> <span translate>Ignore Permissions</span>
|
||||
<input type="checkbox" ng-model="currentFolder.ignorePerms"/> <span translate>Ignore Permissions</span>
|
||||
</label>
|
||||
</div>
|
||||
<p translate class="help-block">File permission bits are ignored when looking for changes. Use on FAT file systems.</p>
|
||||
@@ -140,7 +140,7 @@
|
||||
<p translate class="help-block">Files are moved to .stversions directory when replaced or deleted by Syncthing.</p>
|
||||
<label translate for="trashcanClean">Clean out after</label>
|
||||
<div class="input-group">
|
||||
<input name="trashcanClean" id="trashcanClean" class="form-control text-right" type="number" ng-model="currentFolder.trashcanClean" required min="0">
|
||||
<input name="trashcanClean" id="trashcanClean" class="form-control text-right" type="number" ng-model="currentFolder.trashcanClean" required="" aria-required="true" min="0"/>
|
||||
<div class="input-group-addon" translate>days</div>
|
||||
</div>
|
||||
<p class="help-block">
|
||||
@@ -152,7 +152,7 @@
|
||||
<div class="form-group" ng-if="currentFolder.fileVersioningSelector=='simple'" ng-class="{'has-error': folderEditor.simpleKeep.$invalid && folderEditor.simpleKeep.$dirty}">
|
||||
<p translate class="help-block">Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.</p>
|
||||
<label translate for="simpleKeep">Keep Versions</label>
|
||||
<input name="simpleKeep" id="simpleKeep" class="form-control" type="number" ng-model="currentFolder.simpleKeep" required min="1">
|
||||
<input name="simpleKeep" id="simpleKeep" class="form-control" type="number" ng-model="currentFolder.simpleKeep" required="" aria-required="true" min="1"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="folderEditor.simpleKeep.$valid || folderEditor.simpleKeep.$pristine">The number of old versions to keep, per file.</span>
|
||||
<span translate ng-if="folderEditor.simpleKeep.$error.required && folderEditor.simpleKeep.$dirty">The number of versions must be a number and cannot be blank.</span>
|
||||
@@ -163,7 +163,7 @@
|
||||
<p class="help-block"><span translate>Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.</span> <span translate>Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.</span></p>
|
||||
<p translate class="help-block">The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.</p>
|
||||
<label translate for="staggeredMaxAge">Maximum Age</label>
|
||||
<input name="staggeredMaxAge" id="staggeredMaxAge" class="form-control" type="number" ng-model="currentFolder.staggeredMaxAge" required min="0">
|
||||
<input name="staggeredMaxAge" id="staggeredMaxAge" class="form-control" type="number" ng-model="currentFolder.staggeredMaxAge" required="" aria-required="true" min="0"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="folderEditor.staggeredMaxAge.$valid || folderEditor.staggeredMaxAge.$pristine">The maximum time to keep a version (in days, set to 0 to keep versions forever).</span>
|
||||
<span translate ng-if="folderEditor.staggeredMaxAge.$error.required && folderEditor.staggeredMaxAge.$dirty">The maximum age must be a number and cannot be blank.</span>
|
||||
@@ -172,15 +172,15 @@
|
||||
</div>
|
||||
<div class="form-group" ng-if="currentFolder.fileVersioningSelector == 'staggered'">
|
||||
<label translate for="staggeredVersionsPath">Versions Path</label>
|
||||
<input name="staggeredVersionsPath" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentFolder.staggeredVersionsPath">
|
||||
<input name="staggeredVersionsPath" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentFolder.staggeredVersionsPath"/>
|
||||
<p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).</p>
|
||||
</div>
|
||||
<div class="form-group" ng-if="currentFolder.fileVersioningSelector=='external'" ng-class="{'has-error': folderEditor.externalCommand.$invalid && folderEditor.externalCommand.$dirty}">
|
||||
<p translate class="help-block">An external command handles the versioning. It has to remove the file from the shared folder.</p>
|
||||
<label translate for="externalCommand">Command</label>
|
||||
<input name="externalCommand" id="externalCommand" class="form-control" type="text" ng-model="currentFolder.externalCommand" required>
|
||||
<input name="externalCommand" id="externalCommand" class="form-control" type="text" ng-model="currentFolder.externalCommand" required="" aria-required="true" />
|
||||
<p class="help-block">
|
||||
<span translate ng-if="folderEditor.externalCommand.$valid || folderEditor.externalCommand.$pristine">The first command line parameter is the folder path and the second parameter is the relative path in the folder.</span>
|
||||
<span translate ng-if="folderEditor.externalCommand.$valid || folderEditor.externalCommand.$pristine">See external versioner help for supported templated command line parameters.</span>
|
||||
<span translate ng-if="folderEditor.externalCommand.$error.required && folderEditor.externalCommand.$dirty">The path cannot be blank.</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label translate for="DeviceName">Device Name</label>
|
||||
<input id="DeviceName" class="form-control" type="text" ng-model="tmpOptions.deviceName">
|
||||
<input id="DeviceName" class="form-control" type="text" ng-model="tmpOptions.deviceName"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label translate for="ListenAddressesStr">Sync Protocol Listen Addresses</label> <a href="https://docs.syncthing.net/users/config.html#listen-addresses" target="_blank"><span class="fa fa-fw fa-book"></span> <span translate>Help</span></a>
|
||||
|
||||
<input id="ListenAddressesStr" class="form-control" type="text" ng-model="tmpOptions._listenAddressesStr">
|
||||
<input id="ListenAddressesStr" class="form-control" type="text" ng-model="tmpOptions._listenAddressesStr"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group" ng-class="{'has-error': settingsEditor.MaxRecvKbps.$invalid && settingsEditor.MaxRecvKbps.$dirty}">
|
||||
<label translate for="MaxRecvKbps">Incoming Rate Limit (KiB/s)</label>
|
||||
<input id="MaxRecvKbps" name="MaxRecvKbps" class="form-control" type="number" ng-model="tmpOptions.maxRecvKbps" min="0">
|
||||
<input id="MaxRecvKbps" name="MaxRecvKbps" class="form-control" type="number" ng-model="tmpOptions.maxRecvKbps" min="0"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="settingsEditor.MaxRecvKbps.$error.min && settingsEditor.MaxRecvKbps.$dirty">The rate limit must be a non-negative number (0: no limit)</span>
|
||||
</p>
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div class="form-group" ng-class="{'has-error': settingsEditor.MaxSendKbps.$invalid && settingsEditor.MaxSendKbps.$dirty}">
|
||||
<label translate for="MaxSendKbps">Outgoing Rate Limit (KiB/s)</label>
|
||||
<input id="MaxSendKbps" name="MaxSendKbps" class="form-control" type="number" ng-model="tmpOptions.maxSendKbps" min="0">
|
||||
<input id="MaxSendKbps" name="MaxSendKbps" class="form-control" type="number" ng-model="tmpOptions.maxSendKbps" min="0"/>
|
||||
<p class="help-block">
|
||||
<span translate ng-if="settingsEditor.MaxSendKbps.$error.min && settingsEditor.MaxSendKbps.$dirty">The rate limit must be a non-negative number (0: no limit)</span>
|
||||
</p>
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="NATEnabled" type="checkbox" ng-model="tmpOptions.natEnabled"> <span translate>Enable NAT traversal</span>
|
||||
<input id="NATEnabled" type="checkbox" ng-model="tmpOptions.natEnabled"/> <span translate>Enable NAT traversal</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,7 +45,7 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="LocalAnnEnabled" type="checkbox" ng-model="tmpOptions.localAnnounceEnabled"> <span translate>Local Discovery</span>
|
||||
<input id="LocalAnnEnabled" type="checkbox" ng-model="tmpOptions.localAnnounceEnabled"/> <span translate>Local Discovery</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,7 +57,7 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="GlobalAnnEnabled" type="checkbox" ng-model="tmpOptions.globalAnnounceEnabled"> <span translate>Global Discovery</span>
|
||||
<input id="GlobalAnnEnabled" type="checkbox" ng-model="tmpOptions.globalAnnounceEnabled"/> <span translate>Global Discovery</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="RelaysEnabled" type="checkbox" ng-model="tmpOptions.relaysEnabled"> <span translate>Enable Relaying</span>
|
||||
<input id="RelaysEnabled" type="checkbox" ng-model="tmpOptions.relaysEnabled"/> <span translate>Enable Relaying</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,13 +76,13 @@
|
||||
<div class="clearfix"></div>
|
||||
<div class="form-group">
|
||||
<label translate for="GlobalAnnServersStr">Global Discovery Servers</label>
|
||||
<input ng-disabled="!tmpOptions.globalAnnounceEnabled" id="GlobalAnnServersStr" class="form-control" type="text" ng-model="tmpOptions._globalAnnounceServersStr">
|
||||
<input ng-disabled="!tmpOptions.globalAnnounceEnabled" id="GlobalAnnServersStr" class="form-control" type="text" ng-model="tmpOptions._globalAnnounceServersStr"/>
|
||||
</div>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group" ng-class="{'has-error': settingsEditor.minHomeDiskFree.$invalid && settingsEditor.minHomeDiskFree.$dirty}">
|
||||
<label class="col-xs-12" for="minHomeDiskFree"><span translate>Minimum Free Disk Space</span></label><br/>
|
||||
<div class="col-xs-9"><input name="minHomeDiskFree" id="minHomeDiskFree" class="form-control" type="number" ng-model="tmpOptions.minHomeDiskFree.value" required min="0" step="0.01"></div>
|
||||
<div class="col-xs-9"><input name="minHomeDiskFree" id="minHomeDiskFree" class="form-control" type="number" ng-model="tmpOptions.minHomeDiskFree.value" required="" aria-required="true" min="0" step="0.01"/></div>
|
||||
<div class="col-xs-3"><select class="col-sm-3 form-control" ng-model="tmpOptions.minHomeDiskFree.unit">
|
||||
<option value="%">%</option>
|
||||
<option value="kB">kB</option>
|
||||
@@ -102,30 +102,30 @@
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" ng-class="{'has-error': settingsEditor.Address.$invalid && settingsEditor.Address.$dirty}">
|
||||
<label translate for="Address">GUI Listen Address</label> <a href="https://docs.syncthing.net/users/guilisten.html" target="_blank"><span class="fa fa-fw fa-book"></span> <span translate>Help</span></a>
|
||||
<input id="Address" name="Address" class="form-control" type="text" ng-model="tmpGUI.address" ng-pattern="/.*:0*((102[4-9])|(10[3-9][0-9])|(1[1-9][0-9][0-9])|([2-9][0-9][0-9][0-9])|([1-6]\d{4}))$/">
|
||||
<input id="Address" name="Address" class="form-control" type="text" ng-model="tmpGUI.address" ng-pattern="/.*:0*((102[4-9])|(10[3-9][0-9])|(1[1-9][0-9][0-9])|([2-9][0-9][0-9][0-9])|([1-6]\d{4}))$/"/>
|
||||
<p class="help-block" ng-show="settingsEditor.Address.$invalid" translate>
|
||||
Enter a non-privileged port number (1024 - 65535).
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label translate for="User">GUI Authentication User</label>
|
||||
<input id="User" class="form-control" type="text" ng-model="tmpGUI.user">
|
||||
<input id="User" class="form-control" type="text" ng-model="tmpGUI.user"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label translate for="Password">GUI Authentication Password</label>
|
||||
<input id="Password" class="form-control" type="password" ng-model="tmpGUI.password" ng-trim="false">
|
||||
<input id="Password" class="form-control" type="password" ng-model="tmpGUI.password" ng-trim="false"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="UseTLS" type="checkbox" ng-model="tmpGUI.useTLS"> <span translate>Use HTTPS for GUI</span>
|
||||
<input id="UseTLS" type="checkbox" ng-model="tmpGUI.useTLS"/> <span translate>Use HTTPS for GUI</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="StartBrowser" type="checkbox" ng-model="tmpOptions.startBrowser"> <span translate>Start Browser</span>
|
||||
<input id="StartBrowser" type="checkbox" ng-model="tmpOptions.startBrowser"/> <span translate>Start Browser</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,7 +141,7 @@
|
||||
<div class="form-group">
|
||||
<div class="checkbox" ng-if="tmpOptions.upgrades != 'candidate'">
|
||||
<label>
|
||||
<input id="UREnabled" type="checkbox" ng-model="tmpOptions.urEnabled"> <span translate>Anonymous Usage Reporting</span> (<a href="" translate data-toggle="modal" data-target="#urPreview">Preview</a>)
|
||||
<input id="UREnabled" type="checkbox" ng-model="tmpOptions.urEnabled"/> <span translate>Anonymous Usage Reporting</span> (<a href="" translate data-toggle="modal" data-target="#urPreview">Preview</a>)
|
||||
</label>
|
||||
</div>
|
||||
<p class="help-block" ng-if="tmpOptions.upgrades == 'candidate'">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<ul class="pagination pull-right">
|
||||
<li ng-repeat="option in [10, 25, 50]" ng-class="{ active: failedPageSize == option }">
|
||||
<a href="#" ng-click="failedChangePageSize(option)">{{option}}</a>
|
||||
<li>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<ul class="pagination pull-right">
|
||||
<li ng-repeat="option in [10, 25, 50]" ng-class="{ active: neededPageSize == option }">
|
||||
<a href="#" ng-click="neededChangePageSize(option)">{{option}}</a>
|
||||
<li>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
@@ -17,10 +17,13 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/rand"
|
||||
"github.com/syncthing/syncthing/lib/upgrade"
|
||||
@@ -29,7 +32,7 @@ import (
|
||||
|
||||
const (
|
||||
OldestHandledVersion = 10
|
||||
CurrentVersion = 20
|
||||
CurrentVersion = 22
|
||||
MaxRescanIntervalS = 365 * 24 * 60 * 60
|
||||
)
|
||||
|
||||
@@ -268,6 +271,14 @@ func (cfg *Configuration) clean() error {
|
||||
seenFolders[folder.ID] = struct{}{}
|
||||
}
|
||||
|
||||
// Remove ignored folders that are anyway part of the configuration.
|
||||
for i := 0; i < len(cfg.IgnoredFolders); i++ {
|
||||
if _, ok := seenFolders[cfg.IgnoredFolders[i]]; ok {
|
||||
cfg.IgnoredFolders = append(cfg.IgnoredFolders[:i], cfg.IgnoredFolders[i+1:]...)
|
||||
i-- // IgnoredFolders[i] now points to something else, so needs to be rechecked
|
||||
}
|
||||
}
|
||||
|
||||
cfg.Options.ListenAddresses = util.UniqueStrings(cfg.Options.ListenAddresses)
|
||||
cfg.Options.GlobalAnnServers = util.UniqueStrings(cfg.Options.GlobalAnnServers)
|
||||
|
||||
@@ -306,6 +317,12 @@ func (cfg *Configuration) clean() error {
|
||||
if cfg.Version == 19 {
|
||||
convertV19V20(cfg)
|
||||
}
|
||||
if cfg.Version == 20 {
|
||||
convertV20V21(cfg)
|
||||
}
|
||||
if cfg.Version == 21 {
|
||||
convertV21V22(cfg)
|
||||
}
|
||||
|
||||
// Build a list of available devices
|
||||
existingDevices := make(map[protocol.DeviceID]bool)
|
||||
@@ -355,6 +372,45 @@ func (cfg *Configuration) clean() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func convertV21V22(cfg *Configuration) {
|
||||
for i := range cfg.Folders {
|
||||
cfg.Folders[i].FilesystemType = fs.FilesystemTypeBasic
|
||||
// Migrate to templated external versioner commands
|
||||
if cfg.Folders[i].Versioning.Type == "external" {
|
||||
cfg.Folders[i].Versioning.Params["command"] += " %FOLDER_PATH% %FILE_PATH%"
|
||||
}
|
||||
}
|
||||
|
||||
cfg.Version = 22
|
||||
}
|
||||
|
||||
func convertV20V21(cfg *Configuration) {
|
||||
for _, folder := range cfg.Folders {
|
||||
if folder.FilesystemType != fs.FilesystemTypeBasic {
|
||||
continue
|
||||
}
|
||||
switch folder.Versioning.Type {
|
||||
case "simple", "trashcan":
|
||||
// Clean out symlinks in the known place
|
||||
cleanSymlinks(folder.Filesystem(), ".stversions")
|
||||
case "staggered":
|
||||
versionDir := folder.Versioning.Params["versionsPath"]
|
||||
if versionDir == "" {
|
||||
// default place
|
||||
cleanSymlinks(folder.Filesystem(), ".stversions")
|
||||
} else if filepath.IsAbs(versionDir) {
|
||||
// absolute
|
||||
cleanSymlinks(fs.NewFilesystem(fs.FilesystemTypeBasic, versionDir), ".")
|
||||
} else {
|
||||
// relative to folder
|
||||
cleanSymlinks(folder.Filesystem(), versionDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cfg.Version = 21
|
||||
}
|
||||
|
||||
func convertV19V20(cfg *Configuration) {
|
||||
cfg.Options.MinHomeDiskFree = Size{Value: cfg.Options.DeprecatedMinHomeDiskFreePct, Unit: "%"}
|
||||
cfg.Options.DeprecatedMinHomeDiskFreePct = 0
|
||||
@@ -391,9 +447,7 @@ func convertV17V18(cfg *Configuration) {
|
||||
}
|
||||
|
||||
func convertV16V17(cfg *Configuration) {
|
||||
for i := range cfg.Folders {
|
||||
cfg.Folders[i].Fsync = true
|
||||
}
|
||||
// Fsync = true removed
|
||||
|
||||
cfg.Version = 17
|
||||
}
|
||||
@@ -632,3 +686,23 @@ loop:
|
||||
}
|
||||
return devices[0:count]
|
||||
}
|
||||
|
||||
func cleanSymlinks(filesystem fs.Filesystem, dir string) {
|
||||
if runtime.GOOS == "windows" {
|
||||
// We don't do symlinks on Windows. Additionally, there may
|
||||
// be things that look like symlinks that are not, which we
|
||||
// should leave alone. Deduplicated files, for example.
|
||||
return
|
||||
}
|
||||
filesystem.Walk(dir, func(path string, info fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.IsSymlink() {
|
||||
l.Infoln("Removing incorrectly versioned symlink", path)
|
||||
filesystem.Remove(path)
|
||||
return fs.SkipDir
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/d4l3k/messagediff"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
)
|
||||
|
||||
@@ -73,6 +74,7 @@ func TestDefaultValues(t *testing.T) {
|
||||
KCPSendWindowSize: 128,
|
||||
KCPUpdateIntervalMs: 25,
|
||||
KCPFastResend: false,
|
||||
DefaultFolderPath: "~",
|
||||
}
|
||||
|
||||
cfg := New(device1)
|
||||
@@ -102,7 +104,8 @@ func TestDeviceConfig(t *testing.T) {
|
||||
expectedFolders := []FolderConfiguration{
|
||||
{
|
||||
ID: "test",
|
||||
RawPath: "testdata",
|
||||
FilesystemType: fs.FilesystemTypeBasic,
|
||||
Path: "testdata",
|
||||
Devices: []FolderDeviceConfiguration{{DeviceID: device1}, {DeviceID: device4}},
|
||||
Type: FolderTypeSendOnly,
|
||||
RescanIntervalS: 600,
|
||||
@@ -112,7 +115,6 @@ func TestDeviceConfig(t *testing.T) {
|
||||
AutoNormalize: true,
|
||||
MinDiskFree: Size{1, "%"},
|
||||
MaxConflicts: -1,
|
||||
Fsync: true,
|
||||
Versioning: VersioningConfiguration{
|
||||
Params: map[string]string{},
|
||||
},
|
||||
@@ -120,15 +122,11 @@ func TestDeviceConfig(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// The cachedPath will have been resolved to an absolute path,
|
||||
// The cachedFilesystem will have been resolved to an absolute path,
|
||||
// depending on where the tests are running. Zero it out so we don't
|
||||
// fail based on that.
|
||||
for i := range cfg.Folders {
|
||||
cfg.Folders[i].cachedPath = ""
|
||||
}
|
||||
|
||||
if runtime.GOOS != "windows" {
|
||||
expectedFolders[0].RawPath += string(filepath.Separator)
|
||||
cfg.Folders[i].cachedFilesystem = nil
|
||||
}
|
||||
|
||||
expectedDevices := []DeviceConfiguration{
|
||||
@@ -221,6 +219,7 @@ func TestOverriddenValues(t *testing.T) {
|
||||
KCPSendWindowSize: 1280,
|
||||
KCPUpdateIntervalMs: 1000,
|
||||
KCPFastResend: true,
|
||||
DefaultFolderPath: "/media/syncthing",
|
||||
}
|
||||
|
||||
os.Unsetenv("STNOUPGRADE")
|
||||
@@ -375,16 +374,17 @@ func TestVersioningConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIssue1262(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Skipf("path gets converted to absolute as part of the filesystem initialization on linux")
|
||||
}
|
||||
|
||||
cfg, err := Load("testdata/issue-1262.xml", device4)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
actual := cfg.Folders()["test"].RawPath
|
||||
expected := "e:/"
|
||||
if runtime.GOOS == "windows" {
|
||||
expected = `e:\`
|
||||
}
|
||||
actual := cfg.Folders()["test"].Filesystem().URI()
|
||||
expected := `e:\`
|
||||
|
||||
if actual != expected {
|
||||
t.Errorf("%q != %q", actual, expected)
|
||||
@@ -414,43 +414,12 @@ func TestIssue1750(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWindowsPaths(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Skip("Not useful on non-Windows")
|
||||
return
|
||||
}
|
||||
|
||||
folder := FolderConfiguration{
|
||||
RawPath: `e:\`,
|
||||
}
|
||||
|
||||
expected := `\\?\e:\`
|
||||
actual := folder.Path()
|
||||
if actual != expected {
|
||||
t.Errorf("%q != %q", actual, expected)
|
||||
}
|
||||
|
||||
folder.RawPath = `\\192.0.2.22\network\share`
|
||||
expected = folder.RawPath
|
||||
actual = folder.Path()
|
||||
if actual != expected {
|
||||
t.Errorf("%q != %q", actual, expected)
|
||||
}
|
||||
|
||||
folder.RawPath = `relative\path`
|
||||
expected = folder.RawPath
|
||||
actual = folder.Path()
|
||||
if actual == expected || !strings.HasPrefix(actual, "\\\\?\\") {
|
||||
t.Errorf("%q == %q, expected absolutification", actual, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFolderPath(t *testing.T) {
|
||||
folder := FolderConfiguration{
|
||||
RawPath: "~/tmp",
|
||||
Path: "~/tmp",
|
||||
}
|
||||
|
||||
realPath := folder.Path()
|
||||
realPath := folder.Filesystem().URI()
|
||||
if !filepath.IsAbs(realPath) {
|
||||
t.Error(realPath, "should be absolute")
|
||||
}
|
||||
@@ -675,8 +644,8 @@ func TestEmptyFolderPaths(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
folder := wrapper.Folders()["f1"]
|
||||
if folder.Path() != "" {
|
||||
t.Errorf("Expected %q to be empty", folder.Path())
|
||||
if folder.cachedFilesystem != nil {
|
||||
t.Errorf("Expected %q to be empty", folder.cachedFilesystem)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,3 +776,34 @@ func TestSharesRemovedOnDeviceRemoval(t *testing.T) {
|
||||
t.Error("Unexpected extra device")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssue4219(t *testing.T) {
|
||||
// Adding a folder that was previously ignored should make it unignored.
|
||||
|
||||
r := bytes.NewReader([]byte(`{
|
||||
"folders": [
|
||||
{"id": "abcd123"}
|
||||
],
|
||||
"ignoredFolders": ["t1", "abcd123", "t2"]
|
||||
}`))
|
||||
|
||||
cfg, err := ReadJSON(r, protocol.LocalDeviceID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(cfg.IgnoredFolders) != 2 {
|
||||
t.Errorf("There should be two ignored folders, not %d", len(cfg.IgnoredFolders))
|
||||
}
|
||||
|
||||
w := Wrap("/tmp/cfg", cfg)
|
||||
if !w.IgnoredFolder("t1") {
|
||||
t.Error("Folder t1 should be ignored")
|
||||
}
|
||||
if !w.IgnoredFolder("t2") {
|
||||
t.Error("Folder t2 should be ignored")
|
||||
}
|
||||
if w.IgnoredFolder("abcd123") {
|
||||
t.Error("Folder abcd123 should not be ignored")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,19 +8,17 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
)
|
||||
|
||||
type FolderConfiguration struct {
|
||||
ID string `xml:"id,attr" json:"id"`
|
||||
Label string `xml:"label,attr" json:"label"`
|
||||
RawPath string `xml:"path,attr" json:"path"`
|
||||
FilesystemType fs.FilesystemType `xml:"filesystemType" json:"filesystemType"`
|
||||
Path string `xml:"path,attr" json:"path"`
|
||||
Type FolderType `xml:"type,attr" json:"type"`
|
||||
Devices []FolderDeviceConfiguration `xml:"device" json:"devices"`
|
||||
RescanIntervalS int `xml:"rescanIntervalS,attr" json:"rescanIntervalS"`
|
||||
@@ -39,11 +37,10 @@ type FolderConfiguration struct {
|
||||
MaxConflicts int `xml:"maxConflicts" json:"maxConflicts"`
|
||||
DisableSparseFiles bool `xml:"disableSparseFiles" json:"disableSparseFiles"`
|
||||
DisableTempIndexes bool `xml:"disableTempIndexes" json:"disableTempIndexes"`
|
||||
Fsync bool `xml:"fsync" json:"fsync"`
|
||||
Paused bool `xml:"paused" json:"paused"`
|
||||
WeakHashThresholdPct int `xml:"weakHashThresholdPct" json:"weakHashThresholdPct"` // Use weak hash if more than X percent of the file has changed. Set to -1 to always use weak hash.
|
||||
|
||||
cachedPath string
|
||||
cachedFilesystem fs.Filesystem
|
||||
|
||||
DeprecatedReadOnly bool `xml:"ro,attr,omitempty" json:"-"`
|
||||
DeprecatedMinDiskFreePct float64 `xml:"minDiskFreePct,omitempty" json:"-"`
|
||||
@@ -54,10 +51,11 @@ type FolderDeviceConfiguration struct {
|
||||
IntroducedBy protocol.DeviceID `xml:"introducedBy,attr" json:"introducedBy"`
|
||||
}
|
||||
|
||||
func NewFolderConfiguration(id, path string) FolderConfiguration {
|
||||
func NewFolderConfiguration(id string, fsType fs.FilesystemType, path string) FolderConfiguration {
|
||||
f := FolderConfiguration{
|
||||
ID: id,
|
||||
RawPath: path,
|
||||
ID: id,
|
||||
FilesystemType: fsType,
|
||||
Path: path,
|
||||
}
|
||||
f.prepare()
|
||||
return f
|
||||
@@ -71,53 +69,57 @@ func (f FolderConfiguration) Copy() FolderConfiguration {
|
||||
return c
|
||||
}
|
||||
|
||||
func (f FolderConfiguration) Path() string {
|
||||
func (f FolderConfiguration) Filesystem() fs.Filesystem {
|
||||
// This is intentionally not a pointer method, because things like
|
||||
// cfg.Folders["default"].Path() should be valid.
|
||||
|
||||
if f.cachedPath == "" && f.RawPath != "" {
|
||||
l.Infoln("bug: uncached path call (should only happen in tests)")
|
||||
return f.cleanedPath()
|
||||
// cfg.Folders["default"].Filesystem() should be valid.
|
||||
if f.cachedFilesystem == nil && f.Path != "" {
|
||||
l.Infoln("bug: uncached filesystem call (should only happen in tests)")
|
||||
return fs.NewFilesystem(f.FilesystemType, f.Path)
|
||||
}
|
||||
return f.cachedPath
|
||||
return f.cachedFilesystem
|
||||
}
|
||||
|
||||
func (f *FolderConfiguration) CreateMarker() error {
|
||||
if !f.HasMarker() {
|
||||
marker := filepath.Join(f.Path(), ".stfolder")
|
||||
fd, err := os.Create(marker)
|
||||
fs := f.Filesystem()
|
||||
fd, err := fs.Create(".stfolder")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fd.Close()
|
||||
if err := osutil.SyncDir(filepath.Dir(marker)); err != nil {
|
||||
l.Infof("fsync %q failed: %v", filepath.Dir(marker), err)
|
||||
if dir, err := fs.Open("."); err == nil {
|
||||
if serr := dir.Sync(); err != nil {
|
||||
l.Infof("fsync %q failed: %v", ".", serr)
|
||||
}
|
||||
} else {
|
||||
l.Infof("fsync %q failed: %v", ".", err)
|
||||
}
|
||||
osutil.HideFile(marker)
|
||||
fs.Hide(".stfolder")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *FolderConfiguration) HasMarker() bool {
|
||||
_, err := os.Stat(filepath.Join(f.Path(), ".stfolder"))
|
||||
_, err := f.Filesystem().Stat(".stfolder")
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func (f *FolderConfiguration) CreateRoot() (err error) {
|
||||
// Directory permission bits. Will be filtered down to something
|
||||
// sane by umask on Unixes.
|
||||
permBits := os.FileMode(0777)
|
||||
permBits := fs.FileMode(0777)
|
||||
if runtime.GOOS == "windows" {
|
||||
// Windows has no umask so we must chose a safer set of bits to
|
||||
// begin with.
|
||||
permBits = 0700
|
||||
}
|
||||
|
||||
if _, err = os.Stat(f.Path()); os.IsNotExist(err) {
|
||||
if err = osutil.MkdirAll(f.Path(), permBits); err != nil {
|
||||
l.Warnf("Creating directory for %v: %v",
|
||||
f.Description(), err)
|
||||
filesystem := f.Filesystem()
|
||||
|
||||
if _, err = filesystem.Stat("."); fs.IsNotExist(err) {
|
||||
if err = filesystem.MkdirAll(".", permBits); err != nil {
|
||||
l.Warnf("Creating directory for %v: %v", f.Description(), err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,24 +142,10 @@ func (f *FolderConfiguration) DeviceIDs() []protocol.DeviceID {
|
||||
}
|
||||
|
||||
func (f *FolderConfiguration) prepare() {
|
||||
if f.RawPath != "" {
|
||||
// The reason it's done like this:
|
||||
// C: -> C:\ -> C:\ (issue that this is trying to fix)
|
||||
// C:\somedir -> C:\somedir\ -> C:\somedir
|
||||
// C:\somedir\ -> C:\somedir\\ -> C:\somedir
|
||||
// This way in the tests, we get away without OS specific separators
|
||||
// in the test configs.
|
||||
f.RawPath = filepath.Dir(f.RawPath + string(filepath.Separator))
|
||||
|
||||
// If we're not on Windows, we want the path to end with a slash to
|
||||
// penetrate symlinks. On Windows, paths must not end with a slash.
|
||||
if runtime.GOOS != "windows" && f.RawPath[len(f.RawPath)-1] != filepath.Separator {
|
||||
f.RawPath = f.RawPath + string(filepath.Separator)
|
||||
}
|
||||
if f.Path != "" {
|
||||
f.cachedFilesystem = fs.NewFilesystem(f.FilesystemType, f.Path)
|
||||
}
|
||||
|
||||
f.cachedPath = f.cleanedPath()
|
||||
|
||||
if f.RescanIntervalS > MaxRescanIntervalS {
|
||||
f.RescanIntervalS = MaxRescanIntervalS
|
||||
} else if f.RescanIntervalS < 0 {
|
||||
@@ -173,43 +161,6 @@ func (f *FolderConfiguration) prepare() {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *FolderConfiguration) cleanedPath() string {
|
||||
if f.RawPath == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
cleaned := f.RawPath
|
||||
|
||||
// Attempt tilde expansion; leave unchanged in case of error
|
||||
if path, err := osutil.ExpandTilde(cleaned); err == nil {
|
||||
cleaned = path
|
||||
}
|
||||
|
||||
// Attempt absolutification; leave unchanged in case of error
|
||||
if !filepath.IsAbs(cleaned) {
|
||||
// Abs() looks like a fairly expensive syscall on Windows, while
|
||||
// IsAbs() is a whole bunch of string mangling. I think IsAbs() may be
|
||||
// somewhat faster in the general case, hence the outer if...
|
||||
if path, err := filepath.Abs(cleaned); err == nil {
|
||||
cleaned = path
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to enable long filename support on Windows. We may still not
|
||||
// have an absolute path here if the previous steps failed.
|
||||
if runtime.GOOS == "windows" && filepath.IsAbs(cleaned) && !strings.HasPrefix(f.RawPath, `\\`) {
|
||||
return `\\?\` + cleaned
|
||||
}
|
||||
|
||||
// If we're not on Windows, we want the path to end with a slash to
|
||||
// penetrate symlinks. On Windows, paths must not end with a slash.
|
||||
if runtime.GOOS != "windows" && cleaned[len(cleaned)-1] != filepath.Separator {
|
||||
cleaned = cleaned + string(filepath.Separator)
|
||||
}
|
||||
|
||||
return cleaned
|
||||
}
|
||||
|
||||
type FolderDeviceConfigurationList []FolderDeviceConfiguration
|
||||
|
||||
func (l FolderDeviceConfigurationList) Less(a, b int) bool {
|
||||
|
||||
@@ -140,6 +140,7 @@ type OptionsConfiguration struct {
|
||||
KCPCongestionControl bool `xml:"kcpCongestionControl" json:"kcpCongestionControl" default:"true"`
|
||||
KCPSendWindowSize int `xml:"kcpSendWindowSize" json:"kcpSendWindowSize" default:"128"`
|
||||
KCPReceiveWindowSize int `xml:"kcpReceiveWindowSize" json:"kcpReceiveWindowSize" default:"128"`
|
||||
DefaultFolderPath string `xml:"defaultFolderPath" json:"defaultFolderPath" default:"~"`
|
||||
|
||||
DeprecatedUPnPEnabled bool `xml:"upnpEnabled,omitempty" json:"-"`
|
||||
DeprecatedUPnPLeaseM int `xml:"upnpLeaseMinutes,omitempty" json:"-"`
|
||||
|
||||
13
lib/config/testdata/overridenvalues.xml
vendored
13
lib/config/testdata/overridenvalues.xml
vendored
@@ -38,11 +38,12 @@
|
||||
<stunKeepaliveSeconds>10</stunKeepaliveSeconds>
|
||||
<stunServer>a.stun.com</stunServer>
|
||||
<stunServer>b.stun.com</stunServer>
|
||||
<defaultKCPEnabled>true</defaultKCPEnabled>
|
||||
<kcpCongestionControl>false</kcpCongestionControl>
|
||||
<kcpReceiveWindowSize>1280</kcpReceiveWindowSize>
|
||||
<kcpSendWindowSize>1280</kcpSendWindowSize>
|
||||
<kcpUpdateIntervalMs>1000</kcpUpdateIntervalMs>
|
||||
<kcpFastResend>true</kcpFastResend>
|
||||
<defaultKCPEnabled>true</defaultKCPEnabled>
|
||||
<kcpCongestionControl>false</kcpCongestionControl>
|
||||
<kcpReceiveWindowSize>1280</kcpReceiveWindowSize>
|
||||
<kcpSendWindowSize>1280</kcpSendWindowSize>
|
||||
<kcpUpdateIntervalMs>1000</kcpUpdateIntervalMs>
|
||||
<kcpFastResend>true</kcpFastResend>
|
||||
<defaultFolderPath>/media/syncthing</defaultFolderPath>
|
||||
</options>
|
||||
</configuration>
|
||||
|
||||
15
lib/config/testdata/v21.xml
vendored
Normal file
15
lib/config/testdata/v21.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<configuration version="21">
|
||||
<folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
|
||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||
<minDiskFree unit="%">1</minDiskFree>
|
||||
<maxConflicts>-1</maxConflicts>
|
||||
<fsync>true</fsync>
|
||||
</folder>
|
||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" name="node one" compression="metadata">
|
||||
<address>tcp://a</address>
|
||||
</device>
|
||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" name="node two" compression="metadata">
|
||||
<address>tcp://b</address>
|
||||
</device>
|
||||
</configuration>
|
||||
16
lib/config/testdata/v22.xml
vendored
Normal file
16
lib/config/testdata/v22.xml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<configuration version="22">
|
||||
<folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
|
||||
<filesystemType>basic</filesystemType>
|
||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR"></device>
|
||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2"></device>
|
||||
<minDiskFree unit="%">1</minDiskFree>
|
||||
<maxConflicts>-1</maxConflicts>
|
||||
<fsync>true</fsync>
|
||||
</folder>
|
||||
<device id="AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR" name="node one" compression="metadata">
|
||||
<address>tcp://a</address>
|
||||
</device>
|
||||
<device id="P56IOI7-MZJNU2Y-IQGDREY-DM2MGTI-MGL3BXN-PQ6W5BM-TBBZ4TJ-XZWICQ2" name="node two" compression="metadata">
|
||||
<address>tcp://b</address>
|
||||
</device>
|
||||
</configuration>
|
||||
4
lib/config/testdata/versioningconfig.xml
vendored
4
lib/config/testdata/versioningconfig.xml
vendored
@@ -1,5 +1,5 @@
|
||||
<configuration version="10">
|
||||
<folder id="test" directory="testdata/" ro="true">
|
||||
<configuration version="22">
|
||||
<folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
|
||||
<versioning type="simple">
|
||||
<param key="foo" val="bar"/>
|
||||
<param key="baz" val="quux"/>
|
||||
|
||||
@@ -26,8 +26,8 @@ var (
|
||||
|
||||
type filterList []*pfilter.PacketFilter
|
||||
|
||||
// Sort connections by wether the are unspecified or not, as connections
|
||||
// listenin on all addresses are more useful.
|
||||
// Sort connections by whether they are unspecified or not, as connections
|
||||
// listening on all addresses are more useful.
|
||||
func (f filterList) Len() int { return len(f) }
|
||||
func (f filterList) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
|
||||
func (f filterList) Less(i, j int) bool {
|
||||
@@ -92,7 +92,7 @@ func (f *kcpConversationFilter) Outgoing(out []byte, addr net.Addr) {
|
||||
}
|
||||
|
||||
func (kcpConversationFilter) isKCPConv(data []byte) bool {
|
||||
// Need atleast 5 bytes
|
||||
// Need at least 5 bytes
|
||||
if len(data) < 5 {
|
||||
return false
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func (f *stunFilter) ClaimIncoming(in []byte, addr net.Addr) bool {
|
||||
}
|
||||
|
||||
func (f *stunFilter) isStunPayload(data []byte) bool {
|
||||
// Need atleast 20 bytes
|
||||
// Need at least 20 bytes
|
||||
if len(data) < 20 {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -51,14 +51,14 @@ func TestNamespacedTime(t *testing.T) {
|
||||
|
||||
n1 := NewNamespacedKV(ldb, "foo")
|
||||
|
||||
if v, ok := n1.Time("test"); v != (time.Time{}) || ok {
|
||||
if v, ok := n1.Time("test"); !v.IsZero() || ok {
|
||||
t.Errorf("Incorrect return v %v != %v || ok %v != false", v, time.Time{}, ok)
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
n1.PutTime("test", now)
|
||||
|
||||
if v, ok := n1.Time("test"); v != now || !ok {
|
||||
if v, ok := n1.Time("test"); !v.Equal(now) || !ok {
|
||||
t.Errorf("Incorrect return v %v != %v || ok %v != true", v, now, ok)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
type FileSet struct {
|
||||
sequence int64 // Our local sequence number
|
||||
folder string
|
||||
fs fs.Filesystem
|
||||
db *Instance
|
||||
blockmap *BlockMap
|
||||
localSize sizeTracker
|
||||
@@ -113,10 +114,11 @@ func (s *sizeTracker) Size() Counts {
|
||||
return s.Counts
|
||||
}
|
||||
|
||||
func NewFileSet(folder string, db *Instance) *FileSet {
|
||||
func NewFileSet(folder string, fs fs.Filesystem, db *Instance) *FileSet {
|
||||
var s = FileSet{
|
||||
remoteSequence: make(map[protocol.DeviceID]int64),
|
||||
folder: folder,
|
||||
fs: fs,
|
||||
db: db,
|
||||
blockmap: NewBlockMap(db, db.folderIdx.ID([]byte(folder))),
|
||||
updateMutex: sync.NewMutex(),
|
||||
@@ -303,7 +305,7 @@ func (s *FileSet) SetIndexID(device protocol.DeviceID, id protocol.IndexID) {
|
||||
func (s *FileSet) MtimeFS() *fs.MtimeFS {
|
||||
prefix := s.db.mtimesKey([]byte(s.folder))
|
||||
kv := NewNamespacedKV(s.db, string(prefix))
|
||||
return fs.NewMtimeFS(fs.DefaultFilesystem, kv)
|
||||
return fs.NewMtimeFS(s.fs, kv)
|
||||
}
|
||||
|
||||
func (s *FileSet) ListDevices() []protocol.DeviceID {
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
"github.com/d4l3k/messagediff"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
)
|
||||
|
||||
@@ -97,7 +98,7 @@ func (l fileList) String() string {
|
||||
func TestGlobalSet(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
m := db.NewFileSet("test", ldb)
|
||||
m := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
local0 := fileList{
|
||||
protocol.FileInfo{Name: "a", Sequence: 1, Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}, Blocks: genBlocks(1)},
|
||||
@@ -312,7 +313,7 @@ func TestGlobalSet(t *testing.T) {
|
||||
func TestNeedWithInvalid(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test", ldb)
|
||||
s := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
localHave := fileList{
|
||||
protocol.FileInfo{Name: "a", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}, Blocks: genBlocks(1)},
|
||||
@@ -349,7 +350,7 @@ func TestNeedWithInvalid(t *testing.T) {
|
||||
func TestUpdateToInvalid(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test", ldb)
|
||||
s := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
localHave := fileList{
|
||||
protocol.FileInfo{Name: "a", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}, Blocks: genBlocks(1)},
|
||||
@@ -381,7 +382,7 @@ func TestUpdateToInvalid(t *testing.T) {
|
||||
func TestInvalidAvailability(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test", ldb)
|
||||
s := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
remote0Have := fileList{
|
||||
protocol.FileInfo{Name: "both", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1001}}}, Blocks: genBlocks(2)},
|
||||
@@ -419,7 +420,7 @@ func TestInvalidAvailability(t *testing.T) {
|
||||
func TestGlobalReset(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
m := db.NewFileSet("test", ldb)
|
||||
m := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
local := []protocol.FileInfo{
|
||||
{Name: "a", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}},
|
||||
@@ -457,7 +458,7 @@ func TestGlobalReset(t *testing.T) {
|
||||
func TestNeed(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
m := db.NewFileSet("test", ldb)
|
||||
m := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
local := []protocol.FileInfo{
|
||||
{Name: "b", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}},
|
||||
@@ -495,7 +496,7 @@ func TestNeed(t *testing.T) {
|
||||
func TestSequence(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
m := db.NewFileSet("test", ldb)
|
||||
m := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
local1 := []protocol.FileInfo{
|
||||
{Name: "a", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}},
|
||||
@@ -525,7 +526,7 @@ func TestSequence(t *testing.T) {
|
||||
func TestListDropFolder(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s0 := db.NewFileSet("test0", ldb)
|
||||
s0 := db.NewFileSet("test0", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
local1 := []protocol.FileInfo{
|
||||
{Name: "a", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}},
|
||||
{Name: "b", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}},
|
||||
@@ -533,7 +534,7 @@ func TestListDropFolder(t *testing.T) {
|
||||
}
|
||||
s0.Replace(protocol.LocalDeviceID, local1)
|
||||
|
||||
s1 := db.NewFileSet("test1", ldb)
|
||||
s1 := db.NewFileSet("test1", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
local2 := []protocol.FileInfo{
|
||||
{Name: "d", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1002}}}},
|
||||
{Name: "e", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1002}}}},
|
||||
@@ -575,7 +576,7 @@ func TestListDropFolder(t *testing.T) {
|
||||
func TestGlobalNeedWithInvalid(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test1", ldb)
|
||||
s := db.NewFileSet("test1", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
rem0 := fileList{
|
||||
protocol.FileInfo{Name: "a", Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1002}}}, Blocks: genBlocks(4)},
|
||||
@@ -612,7 +613,7 @@ func TestGlobalNeedWithInvalid(t *testing.T) {
|
||||
func TestLongPath(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test", ldb)
|
||||
s := db.NewFileSet("test", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
var b bytes.Buffer
|
||||
for i := 0; i < 100; i++ {
|
||||
@@ -642,7 +643,7 @@ func TestCommitted(t *testing.T) {
|
||||
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test", ldb)
|
||||
s := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
local := []protocol.FileInfo{
|
||||
{Name: string("file"), Version: protocol.Vector{Counters: []protocol.Counter{{ID: myID, Value: 1000}}}},
|
||||
@@ -688,7 +689,7 @@ func BenchmarkUpdateOneFile(b *testing.B) {
|
||||
os.RemoveAll("testdata/benchmarkupdate.db")
|
||||
}()
|
||||
|
||||
m := db.NewFileSet("test", ldb)
|
||||
m := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
m.Replace(protocol.LocalDeviceID, local0)
|
||||
l := local0[4:5]
|
||||
|
||||
@@ -703,7 +704,7 @@ func BenchmarkUpdateOneFile(b *testing.B) {
|
||||
func TestIndexID(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
|
||||
s := db.NewFileSet("test", ldb)
|
||||
s := db.NewFileSet("test)", fs.NewFilesystem(fs.FilesystemTypeBasic, "."), ldb)
|
||||
|
||||
// The Index ID for some random device is zero by default.
|
||||
id := s.IndexID(remoteDevice0)
|
||||
|
||||
@@ -9,30 +9,156 @@ package fs
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/calmh/du"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalidFilename = errors.New("filename is invalid")
|
||||
ErrNotRelative = errors.New("not a relative path")
|
||||
)
|
||||
|
||||
// The BasicFilesystem implements all aspects by delegating to package os.
|
||||
// All paths are relative to the root and cannot (should not) escape the root directory.
|
||||
type BasicFilesystem struct {
|
||||
root string
|
||||
}
|
||||
|
||||
func NewBasicFilesystem() *BasicFilesystem {
|
||||
return new(BasicFilesystem)
|
||||
func newBasicFilesystem(root string) *BasicFilesystem {
|
||||
// The reason it's done like this:
|
||||
// C: -> C:\ -> C:\ (issue that this is trying to fix)
|
||||
// C:\somedir -> C:\somedir\ -> C:\somedir
|
||||
// C:\somedir\ -> C:\somedir\\ -> C:\somedir
|
||||
// This way in the tests, we get away without OS specific separators
|
||||
// in the test configs.
|
||||
root = filepath.Dir(root + string(filepath.Separator))
|
||||
|
||||
// Attempt tilde expansion; leave unchanged in case of error
|
||||
if path, err := ExpandTilde(root); err == nil {
|
||||
root = path
|
||||
}
|
||||
|
||||
// Attempt absolutification; leave unchanged in case of error
|
||||
if !filepath.IsAbs(root) {
|
||||
// Abs() looks like a fairly expensive syscall on Windows, while
|
||||
// IsAbs() is a whole bunch of string mangling. I think IsAbs() may be
|
||||
// somewhat faster in the general case, hence the outer if...
|
||||
if path, err := filepath.Abs(root); err == nil {
|
||||
root = path
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to enable long filename support on Windows. We may still not
|
||||
// have an absolute path here if the previous steps failed.
|
||||
if runtime.GOOS == "windows" {
|
||||
if filepath.IsAbs(root) && !strings.HasPrefix(root, `\\`) {
|
||||
root = `\\?\` + root
|
||||
}
|
||||
// If we're not on Windows, we want the path to end with a slash to
|
||||
// penetrate symlinks. On Windows, paths must not end with a slash.
|
||||
} else if root[len(root)-1] != filepath.Separator {
|
||||
root = root + string(filepath.Separator)
|
||||
}
|
||||
|
||||
return &BasicFilesystem{
|
||||
root: root,
|
||||
}
|
||||
}
|
||||
|
||||
// rooted expands the relative path to the full path that is then used with os
|
||||
// package. If the relative path somehow causes the final path to escape the root
|
||||
// directoy, this returns an error, to prevent accessing files that are not in the
|
||||
// shared directory.
|
||||
func (f *BasicFilesystem) rooted(rel string) (string, error) {
|
||||
// The root must not be empty.
|
||||
if f.root == "" {
|
||||
return "", ErrInvalidFilename
|
||||
}
|
||||
|
||||
pathSep := string(PathSeparator)
|
||||
|
||||
// The expected prefix for the resulting path is the root, with a path
|
||||
// separator at the end.
|
||||
expectedPrefix := filepath.FromSlash(f.root)
|
||||
if !strings.HasSuffix(expectedPrefix, pathSep) {
|
||||
expectedPrefix += pathSep
|
||||
}
|
||||
|
||||
// The relative path should be clean from internal dotdots and similar
|
||||
// funkyness.
|
||||
rel = filepath.FromSlash(rel)
|
||||
if filepath.Clean(rel) != rel {
|
||||
return "", ErrInvalidFilename
|
||||
}
|
||||
|
||||
// It is not acceptable to attempt to traverse upwards.
|
||||
switch rel {
|
||||
case "..", pathSep:
|
||||
return "", ErrNotRelative
|
||||
}
|
||||
if strings.HasPrefix(rel, ".."+pathSep) {
|
||||
return "", ErrNotRelative
|
||||
}
|
||||
|
||||
if strings.HasPrefix(rel, pathSep+pathSep) {
|
||||
// The relative path may pretend to be an absolute path within the
|
||||
// root, but the double path separator on Windows implies something
|
||||
// else. It would get cleaned by the Join below, but it's out of
|
||||
// spec anyway.
|
||||
return "", ErrNotRelative
|
||||
}
|
||||
|
||||
// The supposedly correct path is the one filepath.Join will return, as
|
||||
// it does cleaning and so on. Check that one first to make sure no
|
||||
// obvious escape attempts have been made.
|
||||
joined := filepath.Join(f.root, rel)
|
||||
if rel == "." && !strings.HasSuffix(joined, pathSep) {
|
||||
joined += pathSep
|
||||
}
|
||||
if !strings.HasPrefix(joined, expectedPrefix) {
|
||||
return "", ErrNotRelative
|
||||
}
|
||||
|
||||
return joined, nil
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) unrooted(path string) string {
|
||||
return strings.TrimPrefix(strings.TrimPrefix(path, f.root), string(PathSeparator))
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Chmod(name string, mode FileMode) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Chmod(name, os.FileMode(mode))
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Chtimes(name string, atime time.Time, mtime time.Time) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Chtimes(name, atime, mtime)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Mkdir(name string, perm FileMode) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Mkdir(name, os.FileMode(perm))
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Lstat(name string) (FileInfo, error) {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fi, err := underlyingLstat(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -41,14 +167,38 @@ func (f *BasicFilesystem) Lstat(name string) (FileInfo, error) {
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Remove(name string) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Remove(name)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) RemoveAll(name string) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.RemoveAll(name)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Rename(oldpath, newpath string) error {
|
||||
oldpath, err := f.rooted(oldpath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newpath, err = f.rooted(newpath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Rename(oldpath, newpath)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Stat(name string) (FileInfo, error) {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fi, err := os.Stat(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -57,7 +207,11 @@ func (f *BasicFilesystem) Stat(name string) (FileInfo, error) {
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) DirNames(name string) ([]string, error) {
|
||||
fd, err := os.OpenFile(name, os.O_RDONLY, 0777)
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fd, err := os.OpenFile(name, OptReadOnly, 0777)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -72,19 +226,39 @@ func (f *BasicFilesystem) DirNames(name string) ([]string, error) {
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Open(name string) (File, error) {
|
||||
fd, err := os.Open(name)
|
||||
rootedName, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fsFile{fd}, err
|
||||
fd, err := os.Open(rootedName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fsFile{fd, name}, err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) OpenFile(name string, flags int, mode FileMode) (File, error) {
|
||||
rootedName, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fd, err := os.OpenFile(rootedName, flags, os.FileMode(mode))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fsFile{fd, name}, err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Create(name string) (File, error) {
|
||||
fd, err := os.Create(name)
|
||||
rootedName, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fsFile{fd}, err
|
||||
fd, err := os.Create(rootedName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return fsFile{fd, name}, err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Walk(root string, walkFn WalkFunc) error {
|
||||
@@ -92,9 +266,47 @@ func (f *BasicFilesystem) Walk(root string, walkFn WalkFunc) error {
|
||||
return errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Glob(pattern string) ([]string, error) {
|
||||
pattern, err := f.rooted(pattern)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
files, err := filepath.Glob(pattern)
|
||||
unrooted := make([]string, len(files))
|
||||
for i := range files {
|
||||
unrooted[i] = f.unrooted(files[i])
|
||||
}
|
||||
return unrooted, err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Usage(name string) (Usage, error) {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return Usage{}, err
|
||||
}
|
||||
u, err := du.Get(name)
|
||||
return Usage{
|
||||
Free: u.FreeBytes,
|
||||
Total: u.TotalBytes,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Type() FilesystemType {
|
||||
return FilesystemTypeBasic
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) URI() string {
|
||||
return strings.TrimPrefix(f.root, `\\?\`)
|
||||
}
|
||||
|
||||
// fsFile implements the fs.File interface on top of an os.File
|
||||
type fsFile struct {
|
||||
*os.File
|
||||
name string
|
||||
}
|
||||
|
||||
func (f fsFile) Name() string {
|
||||
return f.name
|
||||
}
|
||||
|
||||
func (f fsFile) Stat() (FileInfo, error) {
|
||||
@@ -105,6 +317,17 @@ func (f fsFile) Stat() (FileInfo, error) {
|
||||
return fsFileInfo{info}, nil
|
||||
}
|
||||
|
||||
func (f fsFile) Sync() error {
|
||||
err := f.File.Sync()
|
||||
// On Windows, fsyncing a directory returns a "handle is invalid"
|
||||
// So we swallow that and let things go through in order not to have to add
|
||||
// a separate way of syncing directories versus files.
|
||||
if err != nil && (runtime.GOOS != "windows" || !strings.Contains(err.Error(), "handle is invalid")) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// fsFileInfo implements the fs.FileInfo interface on top of an os.FileInfo.
|
||||
type fsFileInfo struct {
|
||||
os.FileInfo
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright (C) 2016 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// +build !windows
|
||||
|
||||
package fs
|
||||
|
||||
import "os"
|
||||
|
||||
var symlinksSupported = true
|
||||
|
||||
func DisableSymlinks() {
|
||||
symlinksSupported = false
|
||||
}
|
||||
|
||||
func (BasicFilesystem) SymlinksSupported() bool {
|
||||
return symlinksSupported
|
||||
}
|
||||
|
||||
func (BasicFilesystem) CreateSymlink(name, target string) error {
|
||||
return os.Symlink(target, name)
|
||||
}
|
||||
|
||||
func (BasicFilesystem) ReadSymlink(path string) (string, error) {
|
||||
return os.Readlink(path)
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// Copyright (C) 2014 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// +build windows
|
||||
|
||||
package fs
|
||||
|
||||
import "errors"
|
||||
|
||||
var errNotSupported = errors.New("symlinks not supported")
|
||||
|
||||
func DisableSymlinks() {}
|
||||
|
||||
func (BasicFilesystem) SymlinksSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (BasicFilesystem) ReadSymlink(path string) (string, error) {
|
||||
return "", errNotSupported
|
||||
}
|
||||
|
||||
func (BasicFilesystem) CreateSymlink(path, target string) error {
|
||||
return errNotSupported
|
||||
}
|
||||
486
lib/fs/basicfs_test.go
Normal file
486
lib/fs/basicfs_test.go
Normal file
@@ -0,0 +1,486 @@
|
||||
// Copyright (C) 2017 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func setup(t *testing.T) (Filesystem, string) {
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return newBasicFilesystem(dir), dir
|
||||
}
|
||||
|
||||
func TestChmodFile(t *testing.T) {
|
||||
fs, dir := setup(t)
|
||||
path := filepath.Join(dir, "file")
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
defer os.Chmod(path, 0666)
|
||||
|
||||
fd, err := os.Create(path)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
fd.Close()
|
||||
|
||||
if err := os.Chmod(path, 0666); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if stat, err := os.Stat(path); err != nil || stat.Mode()&os.ModePerm != 0666 {
|
||||
t.Errorf("wrong perm: %t %#o", err == nil, stat.Mode()&os.ModePerm)
|
||||
}
|
||||
|
||||
if err := fs.Chmod("file", 0444); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if stat, err := os.Stat(path); err != nil || stat.Mode()&os.ModePerm != 0444 {
|
||||
t.Errorf("wrong perm: %t %#o", err == nil, stat.Mode()&os.ModePerm)
|
||||
}
|
||||
}
|
||||
|
||||
func TestChmodDir(t *testing.T) {
|
||||
fs, dir := setup(t)
|
||||
path := filepath.Join(dir, "dir")
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
mode := os.FileMode(0755)
|
||||
if runtime.GOOS == "windows" {
|
||||
mode = os.FileMode(0777)
|
||||
}
|
||||
|
||||
defer os.Chmod(path, mode)
|
||||
|
||||
if err := os.Mkdir(path, mode); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if stat, err := os.Stat(path); err != nil || stat.Mode()&os.ModePerm != mode {
|
||||
t.Errorf("wrong perm: %t %#o", err == nil, stat.Mode()&os.ModePerm)
|
||||
}
|
||||
|
||||
if err := fs.Chmod("dir", 0555); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if stat, err := os.Stat(path); err != nil || stat.Mode()&os.ModePerm != 0555 {
|
||||
t.Errorf("wrong perm: %t %#o", err == nil, stat.Mode()&os.ModePerm)
|
||||
}
|
||||
}
|
||||
|
||||
func TestChtimes(t *testing.T) {
|
||||
fs, dir := setup(t)
|
||||
path := filepath.Join(dir, "file")
|
||||
defer os.RemoveAll(dir)
|
||||
fd, err := os.Create(path)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
fd.Close()
|
||||
|
||||
mtime := time.Now().Add(-time.Hour)
|
||||
|
||||
fs.Chtimes("file", mtime, mtime)
|
||||
|
||||
stat, err := os.Stat(path)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
diff := stat.ModTime().Sub(mtime)
|
||||
if diff > 3*time.Second || diff < -3*time.Second {
|
||||
t.Errorf("%s != %s", stat.Mode(), mtime)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
fs, dir := setup(t)
|
||||
path := filepath.Join(dir, "file")
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
t.Errorf("exists?")
|
||||
}
|
||||
|
||||
fd, err := fs.Create("file")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
fd.Close()
|
||||
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateSymlink(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("windows not supported")
|
||||
}
|
||||
|
||||
fs, dir := setup(t)
|
||||
path := filepath.Join(dir, "file")
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
if err := fs.CreateSymlink("blah", "file"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if target, err := os.Readlink(path); err != nil || target != "blah" {
|
||||
t.Error("target", target, "err", err)
|
||||
}
|
||||
|
||||
if err := os.Remove(path); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if err := fs.CreateSymlink(filepath.Join("..", "blah"), "file"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if target, err := os.Readlink(path); err != nil || target != filepath.Join("..", "blah") {
|
||||
t.Error("target", target, "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDirNames(t *testing.T) {
|
||||
fs, dir := setup(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
// Case differences
|
||||
testCases := []string{
|
||||
"a",
|
||||
"bC",
|
||||
}
|
||||
sort.Strings(testCases)
|
||||
|
||||
for _, sub := range testCases {
|
||||
if err := os.Mkdir(filepath.Join(dir, sub), 0777); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
if dirs, err := fs.DirNames("."); err != nil || len(dirs) != len(testCases) {
|
||||
t.Errorf("%s %s %s", err, dirs, testCases)
|
||||
} else {
|
||||
sort.Strings(dirs)
|
||||
for i := range dirs {
|
||||
if dirs[i] != testCases[i] {
|
||||
t.Errorf("%s != %s", dirs[i], testCases[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNames(t *testing.T) {
|
||||
// Tests that all names are without the root directory.
|
||||
fs, dir := setup(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
expected := "file"
|
||||
fd, err := fs.Create(expected)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
defer fd.Close()
|
||||
|
||||
if fd.Name() != expected {
|
||||
t.Errorf("incorrect %s != %s", fd.Name(), expected)
|
||||
}
|
||||
if stat, err := fd.Stat(); err != nil || stat.Name() != expected {
|
||||
t.Errorf("incorrect %s != %s (%v)", stat.Name(), expected, err)
|
||||
}
|
||||
|
||||
if err := fs.Mkdir("dir", 0777); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
expected = filepath.Join("dir", "file")
|
||||
fd, err = fs.Create(expected)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
defer fd.Close()
|
||||
|
||||
if fd.Name() != expected {
|
||||
t.Errorf("incorrect %s != %s", fd.Name(), expected)
|
||||
}
|
||||
|
||||
// os.fd.Stat() returns just base, so do we.
|
||||
if stat, err := fd.Stat(); err != nil || stat.Name() != filepath.Base(expected) {
|
||||
t.Errorf("incorrect %s != %s (%v)", stat.Name(), filepath.Base(expected), err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGlob(t *testing.T) {
|
||||
// Tests that all names are without the root directory.
|
||||
fs, dir := setup(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
for _, dirToCreate := range []string{
|
||||
filepath.Join("a", "test", "b"),
|
||||
filepath.Join("a", "best", "b"),
|
||||
filepath.Join("a", "best", "c"),
|
||||
} {
|
||||
if err := fs.MkdirAll(dirToCreate, 0777); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
pattern string
|
||||
matches []string
|
||||
}{
|
||||
{
|
||||
filepath.Join("a", "?est", "?"),
|
||||
[]string{
|
||||
filepath.Join("a", "test", "b"),
|
||||
filepath.Join("a", "best", "b"),
|
||||
filepath.Join("a", "best", "c"),
|
||||
},
|
||||
},
|
||||
{
|
||||
filepath.Join("a", "?est", "b"),
|
||||
[]string{
|
||||
filepath.Join("a", "test", "b"),
|
||||
filepath.Join("a", "best", "b"),
|
||||
},
|
||||
},
|
||||
{
|
||||
filepath.Join("a", "best", "?"),
|
||||
[]string{
|
||||
filepath.Join("a", "best", "b"),
|
||||
filepath.Join("a", "best", "c"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
results, err := fs.Glob(testCase.pattern)
|
||||
sort.Strings(results)
|
||||
sort.Strings(testCase.matches)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if len(results) != len(testCase.matches) {
|
||||
t.Errorf("result count mismatch")
|
||||
}
|
||||
for i := range testCase.matches {
|
||||
if results[i] != testCase.matches[i] {
|
||||
t.Errorf("%s != %s", results[i], testCase.matches[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsage(t *testing.T) {
|
||||
fs, dir := setup(t)
|
||||
defer os.RemoveAll(dir)
|
||||
usage, err := fs.Usage(".")
|
||||
if err != nil {
|
||||
if runtime.GOOS == "netbsd" || runtime.GOOS == "openbsd" || runtime.GOOS == "solaris" {
|
||||
t.Skip()
|
||||
}
|
||||
t.Errorf("Unexpected error: %s", err)
|
||||
}
|
||||
if usage.Free < 1 {
|
||||
t.Error("Disk is full?", usage.Free)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWindowsPaths(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Skip("Not useful on non-Windows")
|
||||
return
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
input string
|
||||
expectedRoot string
|
||||
expectedURI string
|
||||
}{
|
||||
{`e:\`, `\\?\e:\`, `e:\`},
|
||||
{`\\?\e:\`, `\\?\e:\`, `e:\`},
|
||||
{`\\192.0.2.22\network\share`, `\\192.0.2.22\network\share`, `\\192.0.2.22\network\share`},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
fs := newBasicFilesystem(testCase.input)
|
||||
if fs.root != testCase.expectedRoot {
|
||||
t.Errorf("root %q != %q", fs.root, testCase.expectedRoot)
|
||||
}
|
||||
if fs.URI() != testCase.expectedURI {
|
||||
t.Errorf("uri %q != %q", fs.URI(), testCase.expectedURI)
|
||||
}
|
||||
}
|
||||
|
||||
fs := newBasicFilesystem(`relative\path`)
|
||||
if fs.root == `relative\path` || !strings.HasPrefix(fs.root, "\\\\?\\") {
|
||||
t.Errorf("%q == %q, expected absolutification", fs.root, `relative\path`)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRooted(t *testing.T) {
|
||||
type testcase struct {
|
||||
root string
|
||||
rel string
|
||||
joined string
|
||||
ok bool
|
||||
}
|
||||
cases := []testcase{
|
||||
// Valid cases
|
||||
{"foo", "bar", "foo/bar", true},
|
||||
{"foo", "/bar", "foo/bar", true},
|
||||
{"foo/", "bar", "foo/bar", true},
|
||||
{"foo/", "/bar", "foo/bar", true},
|
||||
{"baz/foo", "bar", "baz/foo/bar", true},
|
||||
{"baz/foo", "/bar", "baz/foo/bar", true},
|
||||
{"baz/foo/", "bar", "baz/foo/bar", true},
|
||||
{"baz/foo/", "/bar", "baz/foo/bar", true},
|
||||
{"foo", "bar/baz", "foo/bar/baz", true},
|
||||
{"foo", "/bar/baz", "foo/bar/baz", true},
|
||||
{"foo/", "bar/baz", "foo/bar/baz", true},
|
||||
{"foo/", "/bar/baz", "foo/bar/baz", true},
|
||||
{"baz/foo", "bar/baz", "baz/foo/bar/baz", true},
|
||||
{"baz/foo", "/bar/baz", "baz/foo/bar/baz", true},
|
||||
{"baz/foo/", "bar/baz", "baz/foo/bar/baz", true},
|
||||
{"baz/foo/", "/bar/baz", "baz/foo/bar/baz", true},
|
||||
|
||||
// Not escape attempts, but oddly formatted relative paths. Disallowed.
|
||||
{"foo", "./bar", "", false},
|
||||
{"baz/foo", "./bar", "", false},
|
||||
{"foo", "./bar/baz", "", false},
|
||||
{"baz/foo", "./bar/baz", "", false},
|
||||
{"baz/foo", "bar/../baz", "", false},
|
||||
{"baz/foo", "/bar/../baz", "", false},
|
||||
{"baz/foo", "./bar/../baz", "", false},
|
||||
{"baz/foo", "bar/../baz", "", false},
|
||||
{"baz/foo", "/bar/../baz", "", false},
|
||||
{"baz/foo", "./bar/../baz", "", false},
|
||||
|
||||
// Results in an allowed path, but does it by probing. Disallowed.
|
||||
{"foo", "../foo", "", false},
|
||||
{"foo", "../foo/bar", "", false},
|
||||
{"baz/foo", "../foo/bar", "", false},
|
||||
{"baz/foo", "../../baz/foo/bar", "", false},
|
||||
{"baz/foo", "bar/../../foo/bar", "", false},
|
||||
{"baz/foo", "bar/../../../baz/foo/bar", "", false},
|
||||
|
||||
// Escape attempts.
|
||||
{"foo", "", "", false},
|
||||
{"foo", "/", "", false},
|
||||
{"foo", "..", "", false},
|
||||
{"foo", "/..", "", false},
|
||||
{"foo", "../", "", false},
|
||||
{"foo", "../bar", "", false},
|
||||
{"foo", "../foobar", "", false},
|
||||
{"foo/", "../bar", "", false},
|
||||
{"foo/", "../foobar", "", false},
|
||||
{"baz/foo", "../bar", "", false},
|
||||
{"baz/foo", "../foobar", "", false},
|
||||
{"baz/foo/", "../bar", "", false},
|
||||
{"baz/foo/", "../foobar", "", false},
|
||||
{"baz/foo/", "bar/../../quux/baz", "", false},
|
||||
|
||||
// Empty root is a misconfiguration.
|
||||
{"", "/foo", "", false},
|
||||
{"", "foo", "", false},
|
||||
{"", ".", "", false},
|
||||
{"", "..", "", false},
|
||||
{"", "/", "", false},
|
||||
{"", "", "", false},
|
||||
|
||||
// Root=/ is valid, and things should be verified as usual.
|
||||
{"/", "foo", "/foo", true},
|
||||
{"/", "/foo", "/foo", true},
|
||||
{"/", "../foo", "", false},
|
||||
{"/", "..", "", false},
|
||||
{"/", "/", "", false},
|
||||
{"/", "", "", false},
|
||||
|
||||
// special case for filesystems to be able to MkdirAll('.') for example
|
||||
{"/", ".", "/", true},
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
extraCases := []testcase{
|
||||
{`c:\`, `foo`, `c:\foo`, true},
|
||||
{`\\?\c:\`, `foo`, `\\?\c:\foo`, true},
|
||||
{`c:\`, `\foo`, `c:\foo`, true},
|
||||
{`\\?\c:\`, `\foo`, `\\?\c:\foo`, true},
|
||||
{`c:\`, `\\foo`, ``, false},
|
||||
{`c:\`, ``, ``, false},
|
||||
{`c:\`, `\`, ``, false},
|
||||
{`\\?\c:\`, `\\foo`, ``, false},
|
||||
{`\\?\c:\`, ``, ``, false},
|
||||
{`\\?\c:\`, `\`, ``, false},
|
||||
|
||||
// makes no sense, but will be treated simply as a bad filename
|
||||
{`c:\foo`, `d:\bar`, `c:\foo\d:\bar`, true},
|
||||
|
||||
// special case for filesystems to be able to MkdirAll('.') for example
|
||||
{`c:\`, `.`, `c:\`, true},
|
||||
{`\\?\c:\`, `.`, `\\?\c:\`, true},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
// Add case where root is backslashed, rel is forward slashed
|
||||
extraCases = append(extraCases, testcase{
|
||||
root: filepath.FromSlash(tc.root),
|
||||
rel: tc.rel,
|
||||
joined: tc.joined,
|
||||
ok: tc.ok,
|
||||
})
|
||||
// and the opposite
|
||||
extraCases = append(extraCases, testcase{
|
||||
root: tc.root,
|
||||
rel: filepath.FromSlash(tc.rel),
|
||||
joined: tc.joined,
|
||||
ok: tc.ok,
|
||||
})
|
||||
// and both backslashed
|
||||
extraCases = append(extraCases, testcase{
|
||||
root: filepath.FromSlash(tc.root),
|
||||
rel: filepath.FromSlash(tc.rel),
|
||||
joined: tc.joined,
|
||||
ok: tc.ok,
|
||||
})
|
||||
}
|
||||
|
||||
cases = append(cases, extraCases...)
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
fs := BasicFilesystem{root: tc.root}
|
||||
res, err := fs.rooted(tc.rel)
|
||||
if tc.ok {
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error for rooted(%q, %q): %v", tc.root, tc.rel, err)
|
||||
continue
|
||||
}
|
||||
exp := filepath.FromSlash(tc.joined)
|
||||
if res != exp {
|
||||
t.Errorf("Unexpected result for rooted(%q, %q): %q != expected %q", tc.root, tc.rel, res, exp)
|
||||
}
|
||||
} else if err == nil {
|
||||
t.Errorf("Unexpected pass for rooted(%q, %q) => %q", tc.root, tc.rel, res)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
57
lib/fs/basicfs_unix.go
Normal file
57
lib/fs/basicfs_unix.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2016 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// +build !windows
|
||||
|
||||
package fs
|
||||
|
||||
import "os"
|
||||
|
||||
func (BasicFilesystem) SymlinksSupported() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) CreateSymlink(target, name string) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Symlink(target, name)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) ReadSymlink(name string) (string, error) {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return os.Readlink(name)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) MkdirAll(name string, perm FileMode) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.MkdirAll(name, os.FileMode(perm))
|
||||
}
|
||||
|
||||
// Unhide is a noop on unix, as unhiding files requires renaming them.
|
||||
// We still check that the relative path does not try to escape the root
|
||||
func (f *BasicFilesystem) Unhide(name string) error {
|
||||
_, err := f.rooted(name)
|
||||
return err
|
||||
}
|
||||
|
||||
// Hide is a noop on unix, as hiding files requires renaming them.
|
||||
// We still check that the relative path does not try to escape the root
|
||||
func (f *BasicFilesystem) Hide(name string) error {
|
||||
_, err := f.rooted(name)
|
||||
return err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Roots() ([]string, error) {
|
||||
return []string{"/"}, nil
|
||||
}
|
||||
165
lib/fs/basicfs_windows.go
Normal file
165
lib/fs/basicfs_windows.go
Normal file
@@ -0,0 +1,165 @@
|
||||
// Copyright (C) 2014 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// +build windows
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var errNotSupported = errors.New("symlinks not supported")
|
||||
|
||||
func (BasicFilesystem) SymlinksSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (BasicFilesystem) ReadSymlink(path string) (string, error) {
|
||||
return "", errNotSupported
|
||||
}
|
||||
|
||||
func (BasicFilesystem) CreateSymlink(path, target string) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
// MkdirAll creates a directory named path, along with any necessary parents,
|
||||
// and returns nil, or else returns an error.
|
||||
// The permission bits perm are used for all directories that MkdirAll creates.
|
||||
// If path is already a directory, MkdirAll does nothing and returns nil.
|
||||
func (f *BasicFilesystem) MkdirAll(path string, perm FileMode) error {
|
||||
path, err := f.rooted(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return f.mkdirAll(path, os.FileMode(perm))
|
||||
}
|
||||
|
||||
// Required due to https://github.com/golang/go/issues/10900
|
||||
func (f *BasicFilesystem) mkdirAll(path string, perm os.FileMode) error {
|
||||
// Fast path: if we can tell whether path is a directory or file, stop with success or error.
|
||||
dir, err := os.Stat(path)
|
||||
if err == nil {
|
||||
if dir.IsDir() {
|
||||
return nil
|
||||
}
|
||||
return &os.PathError{
|
||||
Op: "mkdir",
|
||||
Path: path,
|
||||
Err: syscall.ENOTDIR,
|
||||
}
|
||||
}
|
||||
|
||||
// Slow path: make sure parent exists and then call Mkdir for path.
|
||||
i := len(path)
|
||||
for i > 0 && IsPathSeparator(path[i-1]) { // Skip trailing path separator.
|
||||
i--
|
||||
}
|
||||
|
||||
j := i
|
||||
for j > 0 && !IsPathSeparator(path[j-1]) { // Scan backward over element.
|
||||
j--
|
||||
}
|
||||
|
||||
if j > 1 {
|
||||
// Create parent
|
||||
parent := path[0 : j-1]
|
||||
if parent != filepath.VolumeName(parent) {
|
||||
err = os.MkdirAll(parent, perm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parent now exists; invoke Mkdir and use its result.
|
||||
err = os.Mkdir(path, perm)
|
||||
if err != nil {
|
||||
// Handle arguments like "foo/." by
|
||||
// double-checking that directory doesn't exist.
|
||||
dir, err1 := os.Lstat(path)
|
||||
if err1 == nil && dir.IsDir() {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Unhide(name string) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p, err := syscall.UTF16PtrFromString(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
attrs, err := syscall.GetFileAttributes(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
attrs &^= syscall.FILE_ATTRIBUTE_HIDDEN
|
||||
return syscall.SetFileAttributes(p, attrs)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Hide(name string) error {
|
||||
name, err := f.rooted(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p, err := syscall.UTF16PtrFromString(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
attrs, err := syscall.GetFileAttributes(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
attrs |= syscall.FILE_ATTRIBUTE_HIDDEN
|
||||
return syscall.SetFileAttributes(p, attrs)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Roots() ([]string, error) {
|
||||
kernel32, err := syscall.LoadDLL("kernel32.dll")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
getLogicalDriveStringsHandle, err := kernel32.FindProc("GetLogicalDriveStringsA")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buffer := [1024]byte{}
|
||||
bufferSize := uint32(len(buffer))
|
||||
|
||||
hr, _, _ := getLogicalDriveStringsHandle.Call(uintptr(unsafe.Pointer(&bufferSize)), uintptr(unsafe.Pointer(&buffer)))
|
||||
if hr == 0 {
|
||||
return nil, fmt.Errorf("Syscall failed")
|
||||
}
|
||||
|
||||
var drives []string
|
||||
parts := bytes.Split(buffer[:], []byte{0})
|
||||
for _, part := range parts {
|
||||
if len(part) == 0 {
|
||||
break
|
||||
}
|
||||
drives = append(drives, string(part))
|
||||
}
|
||||
|
||||
return drives, nil
|
||||
}
|
||||
22
lib/fs/debug.go
Normal file
22
lib/fs/debug.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2015 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/logger"
|
||||
)
|
||||
|
||||
var (
|
||||
l = logger.DefaultLogger.NewFacility("filesystem", "Filesystem access")
|
||||
)
|
||||
|
||||
func init() {
|
||||
l.SetDebug("filesystem", strings.Contains(os.Getenv("STTRACE"), "filesystem") || os.Getenv("STTRACE") == "all")
|
||||
}
|
||||
41
lib/fs/errorfs.go
Normal file
41
lib/fs/errorfs.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2016 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package fs
|
||||
|
||||
import "time"
|
||||
|
||||
type errorFilesystem struct {
|
||||
err error
|
||||
fsType FilesystemType
|
||||
uri string
|
||||
}
|
||||
|
||||
func (fs *errorFilesystem) Chmod(name string, mode FileMode) error { return fs.err }
|
||||
func (fs *errorFilesystem) Chtimes(name string, atime time.Time, mtime time.Time) error { return fs.err }
|
||||
func (fs *errorFilesystem) Create(name string) (File, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) CreateSymlink(name, target string) error { return fs.err }
|
||||
func (fs *errorFilesystem) DirNames(name string) ([]string, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) Lstat(name string) (FileInfo, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) Mkdir(name string, perm FileMode) error { return fs.err }
|
||||
func (fs *errorFilesystem) MkdirAll(name string, perm FileMode) error { return fs.err }
|
||||
func (fs *errorFilesystem) Open(name string) (File, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) OpenFile(string, int, FileMode) (File, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) ReadSymlink(name string) (string, error) { return "", fs.err }
|
||||
func (fs *errorFilesystem) Remove(name string) error { return fs.err }
|
||||
func (fs *errorFilesystem) RemoveAll(name string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Rename(oldname, newname string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Stat(name string) (FileInfo, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) SymlinksSupported() bool { return false }
|
||||
func (fs *errorFilesystem) Walk(root string, walkFn WalkFunc) error { return fs.err }
|
||||
func (fs *errorFilesystem) Unhide(name string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Hide(name string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Glob(pattern string) ([]string, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) SyncDir(name string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Roots() ([]string, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) Usage(name string) (Usage, error) { return Usage{}, fs.err }
|
||||
func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType }
|
||||
func (fs *errorFilesystem) URI() string { return fs.uri }
|
||||
@@ -7,6 +7,7 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -22,23 +23,38 @@ type Filesystem interface {
|
||||
DirNames(name string) ([]string, error)
|
||||
Lstat(name string) (FileInfo, error)
|
||||
Mkdir(name string, perm FileMode) error
|
||||
MkdirAll(name string, perm FileMode) error
|
||||
Open(name string) (File, error)
|
||||
OpenFile(name string, flags int, mode FileMode) (File, error)
|
||||
ReadSymlink(name string) (string, error)
|
||||
Remove(name string) error
|
||||
RemoveAll(name string) error
|
||||
Rename(oldname, newname string) error
|
||||
Stat(name string) (FileInfo, error)
|
||||
SymlinksSupported() bool
|
||||
Walk(root string, walkFn WalkFunc) error
|
||||
Hide(name string) error
|
||||
Unhide(name string) error
|
||||
Glob(pattern string) ([]string, error)
|
||||
Roots() ([]string, error)
|
||||
Usage(name string) (Usage, error)
|
||||
Type() FilesystemType
|
||||
URI() string
|
||||
}
|
||||
|
||||
// The File interface abstracts access to a regular file, being a somewhat
|
||||
// smaller interface than os.File
|
||||
type File interface {
|
||||
io.Reader
|
||||
io.WriterAt
|
||||
io.Closer
|
||||
io.Reader
|
||||
io.ReaderAt
|
||||
io.Seeker
|
||||
io.Writer
|
||||
io.WriterAt
|
||||
Name() string
|
||||
Truncate(size int64) error
|
||||
Stat() (FileInfo, error)
|
||||
Sync() error
|
||||
}
|
||||
|
||||
// The FileInfo interface is almost the same as os.FileInfo, but with the
|
||||
@@ -59,12 +75,27 @@ type FileInfo interface {
|
||||
// FileMode is similar to os.FileMode
|
||||
type FileMode uint32
|
||||
|
||||
// ModePerm is the equivalent of os.ModePerm
|
||||
const ModePerm = FileMode(os.ModePerm)
|
||||
// Usage represents filesystem space usage
|
||||
type Usage struct {
|
||||
Free int64
|
||||
Total int64
|
||||
}
|
||||
|
||||
// DefaultFilesystem is the fallback to use when nothing explicitly has
|
||||
// been passed.
|
||||
var DefaultFilesystem Filesystem = NewWalkFilesystem(NewBasicFilesystem())
|
||||
// Equivalents from os package.
|
||||
|
||||
const ModePerm = FileMode(os.ModePerm)
|
||||
const ModeSetgid = FileMode(os.ModeSetgid)
|
||||
const ModeSetuid = FileMode(os.ModeSetuid)
|
||||
const ModeSticky = FileMode(os.ModeSticky)
|
||||
const PathSeparator = os.PathSeparator
|
||||
const OptAppend = os.O_APPEND
|
||||
const OptCreate = os.O_CREATE
|
||||
const OptExclusive = os.O_EXCL
|
||||
const OptReadOnly = os.O_RDONLY
|
||||
const OptReadWrite = os.O_RDWR
|
||||
const OptSync = os.O_SYNC
|
||||
const OptTruncate = os.O_TRUNC
|
||||
const OptWriteOnly = os.O_WRONLY
|
||||
|
||||
// SkipDir is used as a return value from WalkFuncs to indicate that
|
||||
// the directory named in the call is to be skipped. It is not returned
|
||||
@@ -76,3 +107,29 @@ var IsExist = os.IsExist
|
||||
|
||||
// IsNotExist is the equivalent of os.IsNotExist
|
||||
var IsNotExist = os.IsNotExist
|
||||
|
||||
// IsPermission is the equivalent of os.IsPermission
|
||||
var IsPermission = os.IsPermission
|
||||
|
||||
// IsPathSeparator is the equivalent of os.IsPathSeparator
|
||||
var IsPathSeparator = os.IsPathSeparator
|
||||
|
||||
func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
|
||||
var fs Filesystem
|
||||
switch fsType {
|
||||
case FilesystemTypeBasic:
|
||||
fs = NewWalkFilesystem(newBasicFilesystem(uri))
|
||||
default:
|
||||
l.Debugln("Unknown filesystem", fsType, uri)
|
||||
fs = &errorFilesystem{
|
||||
fsType: fsType,
|
||||
uri: uri,
|
||||
err: errors.New("filesystem with type " + fsType.String() + " does not exist."),
|
||||
}
|
||||
}
|
||||
|
||||
if l.ShouldDebug("filesystem") {
|
||||
fs = &logFilesystem{fs}
|
||||
}
|
||||
return fs
|
||||
}
|
||||
|
||||
158
lib/fs/logfs.go
Normal file
158
lib/fs/logfs.go
Normal file
@@ -0,0 +1,158 @@
|
||||
// Copyright (C) 2016 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
type logFilesystem struct {
|
||||
Filesystem
|
||||
}
|
||||
|
||||
func getCaller() string {
|
||||
_, file, line, ok := runtime.Caller(2)
|
||||
if !ok {
|
||||
return "unknown"
|
||||
}
|
||||
return fmt.Sprintf("%s:%d", filepath.Base(file), line)
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Chmod(name string, mode FileMode) error {
|
||||
err := fs.Filesystem.Chmod(name, mode)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Chmod", name, mode, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Chtimes(name string, atime time.Time, mtime time.Time) error {
|
||||
err := fs.Filesystem.Chtimes(name, atime, mtime)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Chtimes", name, atime, mtime, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Create(name string) (File, error) {
|
||||
file, err := fs.Filesystem.Create(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Create", name, file, err)
|
||||
return file, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) CreateSymlink(name, target string) error {
|
||||
err := fs.Filesystem.CreateSymlink(name, target)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "CreateSymlink", name, target, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) DirNames(name string) ([]string, error) {
|
||||
names, err := fs.Filesystem.DirNames(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "DirNames", name, names, err)
|
||||
return names, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Lstat(name string) (FileInfo, error) {
|
||||
info, err := fs.Filesystem.Lstat(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Lstat", name, info, err)
|
||||
return info, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Mkdir(name string, perm FileMode) error {
|
||||
err := fs.Filesystem.Mkdir(name, perm)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Mkdir", name, perm, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) MkdirAll(name string, perm FileMode) error {
|
||||
err := fs.Filesystem.MkdirAll(name, perm)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "MkdirAll", name, perm, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Open(name string) (File, error) {
|
||||
file, err := fs.Filesystem.Open(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Open", name, file, err)
|
||||
return file, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) OpenFile(name string, flags int, mode FileMode) (File, error) {
|
||||
file, err := fs.Filesystem.OpenFile(name, flags, mode)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "OpenFile", name, flags, mode, file, err)
|
||||
return file, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) ReadSymlink(name string) (string, error) {
|
||||
target, err := fs.Filesystem.ReadSymlink(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "ReadSymlink", name, target, err)
|
||||
return target, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Remove(name string) error {
|
||||
err := fs.Filesystem.Remove(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Remove", name, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) RemoveAll(name string) error {
|
||||
err := fs.Filesystem.RemoveAll(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "RemoveAll", name, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Rename(oldname, newname string) error {
|
||||
err := fs.Filesystem.Rename(oldname, newname)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Rename", oldname, newname, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Stat(name string) (FileInfo, error) {
|
||||
info, err := fs.Filesystem.Stat(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Stat", name, info, err)
|
||||
return info, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) SymlinksSupported() bool {
|
||||
supported := fs.Filesystem.SymlinksSupported()
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "SymlinksSupported", supported)
|
||||
return supported
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Walk(root string, walkFn WalkFunc) error {
|
||||
err := fs.Filesystem.Walk(root, walkFn)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Walk", root, walkFn, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Unhide(name string) error {
|
||||
err := fs.Filesystem.Unhide(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Unhide", name, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Hide(name string) error {
|
||||
err := fs.Filesystem.Hide(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Hide", name, err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Glob(name string) ([]string, error) {
|
||||
names, err := fs.Filesystem.Glob(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Glob", name, names, err)
|
||||
return names, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Roots() ([]string, error) {
|
||||
roots, err := fs.Filesystem.Roots()
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Roots", roots, err)
|
||||
return roots, err
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) Usage(name string) (Usage, error) {
|
||||
usage, err := fs.Filesystem.Usage(name)
|
||||
l.Debugln(getCaller(), fs.Type(), fs.URI(), "Usage", name, usage, err)
|
||||
return usage, err
|
||||
}
|
||||
@@ -6,12 +6,7 @@
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
)
|
||||
import "time"
|
||||
|
||||
// The database is where we store the virtual mtimes
|
||||
type database interface {
|
||||
@@ -20,36 +15,34 @@ type database interface {
|
||||
Delete(key string)
|
||||
}
|
||||
|
||||
// variable so that we can mock it for testing
|
||||
var osChtimes = os.Chtimes
|
||||
|
||||
// The MtimeFS is a filesystem with nanosecond mtime precision, regardless
|
||||
// of what shenanigans the underlying filesystem gets up to. A nil MtimeFS
|
||||
// just does the underlying operations with no additions.
|
||||
type MtimeFS struct {
|
||||
Filesystem
|
||||
db database
|
||||
chtimes func(string, time.Time, time.Time) error
|
||||
db database
|
||||
}
|
||||
|
||||
func NewMtimeFS(underlying Filesystem, db database) *MtimeFS {
|
||||
return &MtimeFS{
|
||||
Filesystem: underlying,
|
||||
chtimes: underlying.Chtimes, // for mocking it out in the tests
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *MtimeFS) Chtimes(name string, atime, mtime time.Time) error {
|
||||
if f == nil {
|
||||
return osChtimes(name, atime, mtime)
|
||||
return f.chtimes(name, atime, mtime)
|
||||
}
|
||||
|
||||
// Do a normal Chtimes call, don't care if it succeeds or not.
|
||||
osChtimes(name, atime, mtime)
|
||||
f.chtimes(name, atime, mtime)
|
||||
|
||||
// Stat the file to see what happened. Here we *do* return an error,
|
||||
// because it might be "does not exist" or similar. osutil.Lstat is the
|
||||
// souped up version to account for Android breakage.
|
||||
info, err := osutil.Lstat(name)
|
||||
// because it might be "does not exist" or similar.
|
||||
info, err := f.Filesystem.Lstat(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -25,22 +25,22 @@ func TestMtimeFS(t *testing.T) {
|
||||
// a random time with nanosecond precision
|
||||
testTime := time.Unix(1234567890, 123456789)
|
||||
|
||||
mtimefs := NewMtimeFS(DefaultFilesystem, make(mapStore))
|
||||
mtimefs := NewMtimeFS(newBasicFilesystem("."), make(mapStore))
|
||||
|
||||
// Do one Chtimes call that will go through to the normal filesystem
|
||||
osChtimes = os.Chtimes
|
||||
mtimefs.chtimes = os.Chtimes
|
||||
if err := mtimefs.Chtimes("testdata/exists0", testTime, testTime); err != nil {
|
||||
t.Error("Should not have failed:", err)
|
||||
}
|
||||
|
||||
// Do one call that gets an error back from the underlying Chtimes
|
||||
osChtimes = failChtimes
|
||||
mtimefs.chtimes = failChtimes
|
||||
if err := mtimefs.Chtimes("testdata/exists1", testTime, testTime); err != nil {
|
||||
t.Error("Should not have failed:", err)
|
||||
}
|
||||
|
||||
// Do one call that gets struck by an exceptionally evil Chtimes
|
||||
osChtimes = evilChtimes
|
||||
mtimefs.chtimes = evilChtimes
|
||||
if err := mtimefs.Chtimes("testdata/exists2", testTime, testTime); err != nil {
|
||||
t.Error("Should not have failed:", err)
|
||||
}
|
||||
|
||||
36
lib/fs/types.go
Normal file
36
lib/fs/types.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2016 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package fs
|
||||
|
||||
type FilesystemType int
|
||||
|
||||
const (
|
||||
FilesystemTypeBasic FilesystemType = iota // default is basic
|
||||
)
|
||||
|
||||
func (t FilesystemType) String() string {
|
||||
switch t {
|
||||
case FilesystemTypeBasic:
|
||||
return "basic"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
func (t FilesystemType) MarshalText() ([]byte, error) {
|
||||
return []byte(t.String()), nil
|
||||
}
|
||||
|
||||
func (t *FilesystemType) UnmarshalText(bs []byte) error {
|
||||
switch string(bs) {
|
||||
case "basic":
|
||||
*t = FilesystemTypeBasic
|
||||
default:
|
||||
*t = FilesystemTypeBasic
|
||||
}
|
||||
return nil
|
||||
}
|
||||
55
lib/fs/util.go
Normal file
55
lib/fs/util.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// Copyright (C) 2016 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var errNoHome = errors.New("no home directory found - set $HOME (or the platform equivalent)")
|
||||
|
||||
func ExpandTilde(path string) (string, error) {
|
||||
if path == "~" {
|
||||
return getHomeDir()
|
||||
}
|
||||
|
||||
path = filepath.FromSlash(path)
|
||||
if !strings.HasPrefix(path, fmt.Sprintf("~%c", PathSeparator)) {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
home, err := getHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, path[2:]), nil
|
||||
}
|
||||
|
||||
func getHomeDir() (string, error) {
|
||||
var home string
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
home = filepath.Join(os.Getenv("HomeDrive"), os.Getenv("HomePath"))
|
||||
if home == "" {
|
||||
home = os.Getenv("UserProfile")
|
||||
}
|
||||
default:
|
||||
home = os.Getenv("HOME")
|
||||
}
|
||||
|
||||
if home == "" {
|
||||
return "", errNoHome
|
||||
}
|
||||
|
||||
return home, nil
|
||||
}
|
||||
@@ -28,16 +28,16 @@ import "path/filepath"
|
||||
// Walk skips the remaining files in the containing directory.
|
||||
type WalkFunc func(path string, info FileInfo, err error) error
|
||||
|
||||
type WalkFilesystem struct {
|
||||
type walkFilesystem struct {
|
||||
Filesystem
|
||||
}
|
||||
|
||||
func NewWalkFilesystem(next Filesystem) *WalkFilesystem {
|
||||
return &WalkFilesystem{next}
|
||||
func NewWalkFilesystem(next Filesystem) Filesystem {
|
||||
return &walkFilesystem{next}
|
||||
}
|
||||
|
||||
// walk recursively descends path, calling walkFn.
|
||||
func (f *WalkFilesystem) walk(path string, info FileInfo, walkFn WalkFunc) error {
|
||||
func (f *walkFilesystem) walk(path string, info FileInfo, walkFn WalkFunc) error {
|
||||
err := walkFn(path, info, nil)
|
||||
if err != nil {
|
||||
if info.IsDir() && err == SkipDir {
|
||||
@@ -80,7 +80,7 @@ func (f *WalkFilesystem) walk(path string, info FileInfo, walkFn WalkFunc) error
|
||||
// order, which makes the output deterministic but means that for very
|
||||
// large directories Walk can be inefficient.
|
||||
// Walk does not follow symbolic links.
|
||||
func (f *WalkFilesystem) Walk(root string, walkFn WalkFunc) error {
|
||||
func (f *walkFilesystem) Walk(root string, walkFn WalkFunc) error {
|
||||
info, err := f.Lstat(root)
|
||||
if err != nil {
|
||||
return walkFn(root, nil, err)
|
||||
|
||||
@@ -12,13 +12,13 @@ import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gobwas/glob"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/sync"
|
||||
)
|
||||
@@ -70,15 +70,16 @@ func (r Result) IsCaseFolded() bool {
|
||||
// called on it) and if any of the files have Changed(). To forget all
|
||||
// files, call Reset().
|
||||
type ChangeDetector interface {
|
||||
Remember(name string, modtime time.Time)
|
||||
Seen(name string) bool
|
||||
Remember(fs fs.Filesystem, name string, modtime time.Time)
|
||||
Seen(fs fs.Filesystem, name string) bool
|
||||
Changed() bool
|
||||
Reset()
|
||||
}
|
||||
|
||||
type Matcher struct {
|
||||
lines []string
|
||||
patterns []Pattern
|
||||
fs fs.Filesystem
|
||||
lines []string // exact lines read from .stignore
|
||||
patterns []Pattern // patterns including those from included files
|
||||
withCache bool
|
||||
matches *cache
|
||||
curHash string
|
||||
@@ -105,8 +106,9 @@ func WithChangeDetector(cd ChangeDetector) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func New(opts ...Option) *Matcher {
|
||||
func New(fs fs.Filesystem, opts ...Option) *Matcher {
|
||||
m := &Matcher{
|
||||
fs: fs,
|
||||
stop: make(chan struct{}),
|
||||
mut: sync.NewMutex(),
|
||||
}
|
||||
@@ -126,11 +128,11 @@ func (m *Matcher) Load(file string) error {
|
||||
m.mut.Lock()
|
||||
defer m.mut.Unlock()
|
||||
|
||||
if m.changeDetector.Seen(file) && !m.changeDetector.Changed() {
|
||||
if m.changeDetector.Seen(m.fs, file) && !m.changeDetector.Changed() {
|
||||
return nil
|
||||
}
|
||||
|
||||
fd, err := os.Open(file)
|
||||
fd, err := m.fs.Open(file)
|
||||
if err != nil {
|
||||
m.parseLocked(&bytes.Buffer{}, file)
|
||||
return err
|
||||
@@ -144,7 +146,7 @@ func (m *Matcher) Load(file string) error {
|
||||
}
|
||||
|
||||
m.changeDetector.Reset()
|
||||
m.changeDetector.Remember(file, info.ModTime())
|
||||
m.changeDetector.Remember(m.fs, file, info.ModTime())
|
||||
|
||||
return m.parseLocked(fd, file)
|
||||
}
|
||||
@@ -156,7 +158,7 @@ func (m *Matcher) Parse(r io.Reader, file string) error {
|
||||
}
|
||||
|
||||
func (m *Matcher) parseLocked(r io.Reader, file string) error {
|
||||
lines, patterns, err := parseIgnoreFile(r, file, m.changeDetector)
|
||||
lines, patterns, err := parseIgnoreFile(m.fs, r, file, m.changeDetector)
|
||||
// Error is saved and returned at the end. We process the patterns
|
||||
// (possibly blank) anyway.
|
||||
|
||||
@@ -298,12 +300,23 @@ func hashPatterns(patterns []Pattern) string {
|
||||
return fmt.Sprintf("%x", h.Sum(nil))
|
||||
}
|
||||
|
||||
func loadIgnoreFile(file string, cd ChangeDetector) ([]string, []Pattern, error) {
|
||||
if cd.Seen(file) {
|
||||
func loadIgnoreFile(filesystem fs.Filesystem, file string, cd ChangeDetector) ([]string, []Pattern, error) {
|
||||
if cd.Seen(filesystem, file) {
|
||||
return nil, nil, fmt.Errorf("multiple include of ignore file %q", file)
|
||||
}
|
||||
|
||||
fd, err := os.Open(file)
|
||||
// Allow escaping the folders filesystem.
|
||||
// TODO: Deprecate, somehow?
|
||||
if filesystem.Type() == fs.FilesystemTypeBasic {
|
||||
uri := filesystem.URI()
|
||||
joined := filepath.Join(uri, file)
|
||||
if !strings.HasPrefix(joined, uri) {
|
||||
filesystem = fs.NewFilesystem(filesystem.Type(), filepath.Dir(joined))
|
||||
file = filepath.Base(joined)
|
||||
}
|
||||
}
|
||||
|
||||
fd, err := filesystem.Open(file)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -314,12 +327,12 @@ func loadIgnoreFile(file string, cd ChangeDetector) ([]string, []Pattern, error)
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
cd.Remember(file, info.ModTime())
|
||||
cd.Remember(filesystem, file, info.ModTime())
|
||||
|
||||
return parseIgnoreFile(fd, file, cd)
|
||||
return parseIgnoreFile(filesystem, fd, file, cd)
|
||||
}
|
||||
|
||||
func parseIgnoreFile(fd io.Reader, currentFile string, cd ChangeDetector) ([]string, []Pattern, error) {
|
||||
func parseIgnoreFile(fs fs.Filesystem, fd io.Reader, currentFile string, cd ChangeDetector) ([]string, []Pattern, error) {
|
||||
var lines []string
|
||||
var patterns []Pattern
|
||||
|
||||
@@ -384,13 +397,12 @@ func parseIgnoreFile(fd io.Reader, currentFile string, cd ChangeDetector) ([]str
|
||||
}
|
||||
patterns = append(patterns, pattern)
|
||||
} else if strings.HasPrefix(line, "#include ") {
|
||||
includeRel := line[len("#include "):]
|
||||
includeRel := strings.TrimSpace(line[len("#include "):])
|
||||
includeFile := filepath.Join(filepath.Dir(currentFile), includeRel)
|
||||
includeLines, includePatterns, err := loadIgnoreFile(includeFile, cd)
|
||||
_, includePatterns, err := loadIgnoreFile(fs, includeFile, cd)
|
||||
if err != nil {
|
||||
return fmt.Errorf("include of %q: %v", includeRel, err)
|
||||
}
|
||||
lines = append(lines, includeLines...)
|
||||
patterns = append(patterns, includePatterns...)
|
||||
} else {
|
||||
// Path name or pattern, add it so it matches files both in
|
||||
@@ -451,7 +463,7 @@ func parseIgnoreFile(fd io.Reader, currentFile string, cd ChangeDetector) ([]str
|
||||
// path must be clean (i.e., in canonical shortest form).
|
||||
func IsInternal(file string) bool {
|
||||
internals := []string{".stfolder", ".stignore", ".stversions"}
|
||||
pathSep := string(os.PathSeparator)
|
||||
pathSep := string(fs.PathSeparator)
|
||||
for _, internal := range internals {
|
||||
if file == internal {
|
||||
return true
|
||||
@@ -464,8 +476,8 @@ func IsInternal(file string) bool {
|
||||
}
|
||||
|
||||
// WriteIgnores is a convenience function to avoid code duplication
|
||||
func WriteIgnores(path string, content []string) error {
|
||||
fd, err := osutil.CreateAtomic(path)
|
||||
func WriteIgnores(filesystem fs.Filesystem, path string, content []string) error {
|
||||
fd, err := osutil.CreateAtomicFilesystem(filesystem, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -477,38 +489,43 @@ func WriteIgnores(path string, content []string) error {
|
||||
if err := fd.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
osutil.HideFile(path)
|
||||
filesystem.Hide(path)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type modtimeCheckerKey struct {
|
||||
fs fs.Filesystem
|
||||
name string
|
||||
}
|
||||
|
||||
// modtimeChecker is the default implementation of ChangeDetector
|
||||
type modtimeChecker struct {
|
||||
modtimes map[string]time.Time
|
||||
modtimes map[modtimeCheckerKey]time.Time
|
||||
}
|
||||
|
||||
func newModtimeChecker() *modtimeChecker {
|
||||
return &modtimeChecker{
|
||||
modtimes: map[string]time.Time{},
|
||||
modtimes: map[modtimeCheckerKey]time.Time{},
|
||||
}
|
||||
}
|
||||
|
||||
func (c *modtimeChecker) Remember(name string, modtime time.Time) {
|
||||
c.modtimes[name] = modtime
|
||||
func (c *modtimeChecker) Remember(fs fs.Filesystem, name string, modtime time.Time) {
|
||||
c.modtimes[modtimeCheckerKey{fs, name}] = modtime
|
||||
}
|
||||
|
||||
func (c *modtimeChecker) Seen(name string) bool {
|
||||
_, ok := c.modtimes[name]
|
||||
func (c *modtimeChecker) Seen(fs fs.Filesystem, name string) bool {
|
||||
_, ok := c.modtimes[modtimeCheckerKey{fs, name}]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (c *modtimeChecker) Reset() {
|
||||
c.modtimes = map[string]time.Time{}
|
||||
c.modtimes = map[modtimeCheckerKey]time.Time{}
|
||||
}
|
||||
|
||||
func (c *modtimeChecker) Changed() bool {
|
||||
for name, modtime := range c.modtimes {
|
||||
info, err := os.Stat(name)
|
||||
for key, modtime := range c.modtimes {
|
||||
info, err := key.fs.Stat(key.name)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -15,11 +15,14 @@ import (
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
)
|
||||
|
||||
func TestIgnore(t *testing.T) {
|
||||
pats := New(WithCache(true))
|
||||
err := pats.Load("testdata/.stignore")
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata"), WithCache(true))
|
||||
err := pats.Load(".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -68,7 +71,7 @@ func TestExcludes(t *testing.T) {
|
||||
i*2
|
||||
!ign2
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -113,7 +116,7 @@ func TestFlagOrder(t *testing.T) {
|
||||
(?i)(?d)(?d)!ign9
|
||||
(?d)(?d)!ign10
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -148,7 +151,7 @@ func TestDeletables(t *testing.T) {
|
||||
ign7
|
||||
(?i)ign8
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -187,7 +190,7 @@ func TestBadPatterns(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, pat := range badPatterns {
|
||||
err := New(WithCache(true)).Parse(bytes.NewBufferString(pat), ".stignore")
|
||||
err := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true)).Parse(bytes.NewBufferString(pat), ".stignore")
|
||||
if err == nil {
|
||||
t.Errorf("No error for pattern %q", pat)
|
||||
}
|
||||
@@ -195,7 +198,7 @@ func TestBadPatterns(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCaseSensitivity(t *testing.T) {
|
||||
ign := New(WithCache(true))
|
||||
ign := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := ign.Parse(bytes.NewBufferString("test"), ".stignore")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -225,29 +228,36 @@ func TestCaseSensitivity(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCaching(t *testing.T) {
|
||||
fd1, err := ioutil.TempFile("", "")
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fd2, err := ioutil.TempFile("", "")
|
||||
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, dir)
|
||||
|
||||
fd1, err := osutil.TempFile(fs, "", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fd2, err := osutil.TempFile(fs, "", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer fd1.Close()
|
||||
defer fd2.Close()
|
||||
defer os.Remove(fd1.Name())
|
||||
defer os.Remove(fd2.Name())
|
||||
defer fs.Remove(fd1.Name())
|
||||
defer fs.Remove(fd2.Name())
|
||||
|
||||
_, err = fd1.WriteString("/x/\n#include " + filepath.Base(fd2.Name()) + "\n")
|
||||
_, err = fd1.Write([]byte("/x/\n#include " + filepath.Base(fd2.Name()) + "\n"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fd2.WriteString("/y/\n")
|
||||
fd2.Write([]byte("/y/\n"))
|
||||
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs, WithCache(true))
|
||||
err = pats.Load(fd1.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -280,10 +290,10 @@ func TestCaching(t *testing.T) {
|
||||
// Modify the include file, expect empty cache. Ensure the timestamp on
|
||||
// the file changes.
|
||||
|
||||
fd2.WriteString("/z/\n")
|
||||
fd2.Write([]byte("/z/\n"))
|
||||
fd2.Sync()
|
||||
fakeTime := time.Now().Add(5 * time.Second)
|
||||
os.Chtimes(fd2.Name(), fakeTime, fakeTime)
|
||||
fs.Chtimes(fd2.Name(), fakeTime, fakeTime)
|
||||
|
||||
err = pats.Load(fd1.Name())
|
||||
if err != nil {
|
||||
@@ -312,10 +322,10 @@ func TestCaching(t *testing.T) {
|
||||
|
||||
// Modify the root file, expect cache to be invalidated
|
||||
|
||||
fd1.WriteString("/a/\n")
|
||||
fd1.Write([]byte("/a/\n"))
|
||||
fd1.Sync()
|
||||
fakeTime = time.Now().Add(5 * time.Second)
|
||||
os.Chtimes(fd1.Name(), fakeTime, fakeTime)
|
||||
fs.Chtimes(fd1.Name(), fakeTime, fakeTime)
|
||||
|
||||
err = pats.Load(fd1.Name())
|
||||
if err != nil {
|
||||
@@ -354,7 +364,7 @@ func TestCommentsAndBlankLines(t *testing.T) {
|
||||
|
||||
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -382,7 +392,7 @@ flamingo
|
||||
*.crow
|
||||
*.crow
|
||||
`
|
||||
pats := New()
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
b.Error(err)
|
||||
@@ -411,20 +421,27 @@ flamingo
|
||||
*.crow
|
||||
`
|
||||
// Caches per file, hence write the patterns to a file.
|
||||
fd, err := ioutil.TempFile("", "")
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = fd.WriteString(stignore)
|
||||
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, dir)
|
||||
|
||||
fd, err := osutil.TempFile(fs, "", "")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = fd.Write([]byte(stignore))
|
||||
defer fd.Close()
|
||||
defer os.Remove(fd.Name())
|
||||
defer fs.Remove(fd.Name())
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
// Load the patterns
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs, WithCache(true))
|
||||
err = pats.Load(fd.Name())
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
@@ -445,22 +462,29 @@ flamingo
|
||||
}
|
||||
|
||||
func TestCacheReload(t *testing.T) {
|
||||
fd, err := ioutil.TempFile("", "")
|
||||
dir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, dir)
|
||||
|
||||
fd, err := osutil.TempFile(fs, "", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer fd.Close()
|
||||
defer os.Remove(fd.Name())
|
||||
defer fs.Remove(fd.Name())
|
||||
|
||||
// Ignore file matches f1 and f2
|
||||
|
||||
_, err = fd.WriteString("f1\nf2\n")
|
||||
_, err = fd.Write([]byte("f1\nf2\n"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs, WithCache(true))
|
||||
err = pats.Load(fd.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -488,13 +512,13 @@ func TestCacheReload(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = fd.WriteString("f1\nf3\n")
|
||||
_, err = fd.Write([]byte("f1\nf3\n"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fd.Sync()
|
||||
fakeTime := time.Now().Add(5 * time.Second)
|
||||
os.Chtimes(fd.Name(), fakeTime, fakeTime)
|
||||
fs.Chtimes(fd.Name(), fakeTime, fakeTime)
|
||||
|
||||
err = pats.Load(fd.Name())
|
||||
if err != nil {
|
||||
@@ -515,7 +539,7 @@ func TestCacheReload(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHash(t *testing.T) {
|
||||
p1 := New(WithCache(true))
|
||||
p1 := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := p1.Load("testdata/.stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -531,7 +555,7 @@ func TestHash(t *testing.T) {
|
||||
/ffile
|
||||
lost+found
|
||||
`
|
||||
p2 := New(WithCache(true))
|
||||
p2 := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err = p2.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -546,7 +570,7 @@ func TestHash(t *testing.T) {
|
||||
/ffile
|
||||
lost+found
|
||||
`
|
||||
p3 := New(WithCache(true))
|
||||
p3 := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err = p3.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -570,7 +594,7 @@ func TestHash(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHashOfEmpty(t *testing.T) {
|
||||
p1 := New(WithCache(true))
|
||||
p1 := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := p1.Load("testdata/.stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -608,7 +632,7 @@ func TestWindowsPatterns(t *testing.T) {
|
||||
a/b
|
||||
c\d
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -633,7 +657,7 @@ func TestAutomaticCaseInsensitivity(t *testing.T) {
|
||||
A/B
|
||||
c/d
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -652,7 +676,7 @@ func TestCommas(t *testing.T) {
|
||||
foo,bar.txt
|
||||
{baz,quux}.txt
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -683,7 +707,7 @@ func TestIssue3164(t *testing.T) {
|
||||
(?d)(?i)/foo
|
||||
(?d)(?i)**/bar
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -719,7 +743,7 @@ func TestIssue3174(t *testing.T) {
|
||||
stignore := `
|
||||
*ä*
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -734,7 +758,7 @@ func TestIssue3639(t *testing.T) {
|
||||
stignore := `
|
||||
foo/
|
||||
`
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -767,7 +791,7 @@ func TestIssue3674(t *testing.T) {
|
||||
{"as/dc", true},
|
||||
}
|
||||
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -799,7 +823,7 @@ func TestGobwasGlobIssue18(t *testing.T) {
|
||||
{"bbaa", false},
|
||||
}
|
||||
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -859,7 +883,7 @@ func TestRoot(t *testing.T) {
|
||||
{"b", true},
|
||||
}
|
||||
|
||||
pats := New(WithCache(true))
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -872,3 +896,38 @@ func TestRoot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLines(t *testing.T) {
|
||||
stignore := `
|
||||
#include testdata/excludes
|
||||
|
||||
!/a
|
||||
/*
|
||||
`
|
||||
|
||||
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expectedLines := []string{
|
||||
"",
|
||||
"#include testdata/excludes",
|
||||
"",
|
||||
"!/a",
|
||||
"/*",
|
||||
"",
|
||||
}
|
||||
|
||||
lines := pats.Lines()
|
||||
if len(lines) != len(expectedLines) {
|
||||
t.Fatalf("len(Lines()) == %d, expected %d", len(lines), len(expectedLines))
|
||||
}
|
||||
for i := range lines {
|
||||
if lines[i] != expectedLines[i] {
|
||||
t.Fatalf("Lines()[%d] == %s, expected %s", i, lines[i], expectedLines[i])
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
@@ -81,6 +80,7 @@ type Model struct {
|
||||
clientVersion string
|
||||
|
||||
folderCfgs map[string]config.FolderConfiguration // folder -> cfg
|
||||
folderFs map[string]fs.Filesystem // folder -> fs
|
||||
folderFiles map[string]*db.FileSet // folder -> files
|
||||
folderDevices folderDeviceSet // folder -> deviceIDs
|
||||
deviceFolders map[protocol.DeviceID][]string // deviceID -> folders
|
||||
@@ -99,21 +99,18 @@ type Model struct {
|
||||
pmut sync.RWMutex // protects the above
|
||||
}
|
||||
|
||||
type folderFactory func(*Model, config.FolderConfiguration, versioner.Versioner, *fs.MtimeFS) service
|
||||
type folderFactory func(*Model, config.FolderConfiguration, versioner.Versioner, fs.Filesystem) service
|
||||
|
||||
var (
|
||||
folderFactories = make(map[config.FolderType]folderFactory, 0)
|
||||
)
|
||||
|
||||
var (
|
||||
errFolderPathEmpty = errors.New("folder path empty")
|
||||
errFolderPathMissing = errors.New("folder path missing")
|
||||
errFolderMarkerMissing = errors.New("folder marker missing")
|
||||
errInvalidFilename = errors.New("filename is invalid")
|
||||
errDeviceUnknown = errors.New("unknown device")
|
||||
errDevicePaused = errors.New("device is paused")
|
||||
errDeviceIgnored = errors.New("device is ignored")
|
||||
errNotRelative = errors.New("not a relative path")
|
||||
errFolderPaused = errors.New("folder is paused")
|
||||
errFolderMissing = errors.New("no such folder")
|
||||
errNetworkNotAllowed = errors.New("network not allowed")
|
||||
@@ -140,6 +137,7 @@ func NewModel(cfg *config.Wrapper, id protocol.DeviceID, clientName, clientVersi
|
||||
clientName: clientName,
|
||||
clientVersion: clientVersion,
|
||||
folderCfgs: make(map[string]config.FolderConfiguration),
|
||||
folderFs: make(map[string]fs.Filesystem),
|
||||
folderFiles: make(map[string]*db.FileSet),
|
||||
folderDevices: make(folderDeviceSet),
|
||||
deviceFolders: make(map[protocol.DeviceID][]string),
|
||||
@@ -245,7 +243,7 @@ func (m *Model) startFolderLocked(folder string) config.FolderType {
|
||||
l.Fatalf("Requested versioning type %q that does not exist", cfg.Versioning.Type)
|
||||
}
|
||||
|
||||
ver = versionerFactory(folder, cfg.Path(), cfg.Versioning.Params)
|
||||
ver = versionerFactory(folder, cfg.Filesystem(), cfg.Versioning.Params)
|
||||
if service, ok := ver.(suture.Service); ok {
|
||||
// The versioner implements the suture.Service interface, so
|
||||
// expects to be run in the background in addition to being called
|
||||
@@ -271,7 +269,12 @@ func (m *Model) warnAboutOverwritingProtectedFiles(folder string) {
|
||||
return
|
||||
}
|
||||
|
||||
folderLocation := m.folderCfgs[folder].Path()
|
||||
// This is a bit of a hack.
|
||||
ffs := m.folderCfgs[folder].Filesystem()
|
||||
if ffs.Type() != fs.FilesystemTypeBasic {
|
||||
return
|
||||
}
|
||||
folderLocation := ffs.URI()
|
||||
ignores := m.folderIgnores[folder]
|
||||
|
||||
var filesAtRisk []string
|
||||
@@ -300,6 +303,10 @@ func (m *Model) AddFolder(cfg config.FolderConfiguration) {
|
||||
panic("cannot add empty folder id")
|
||||
}
|
||||
|
||||
if len(cfg.Path) == 0 {
|
||||
panic("cannot add empty folder path")
|
||||
}
|
||||
|
||||
m.fmut.Lock()
|
||||
m.addFolderLocked(cfg)
|
||||
m.fmut.Unlock()
|
||||
@@ -307,15 +314,16 @@ func (m *Model) AddFolder(cfg config.FolderConfiguration) {
|
||||
|
||||
func (m *Model) addFolderLocked(cfg config.FolderConfiguration) {
|
||||
m.folderCfgs[cfg.ID] = cfg
|
||||
m.folderFiles[cfg.ID] = db.NewFileSet(cfg.ID, m.db)
|
||||
folderFs := cfg.Filesystem()
|
||||
m.folderFiles[cfg.ID] = db.NewFileSet(cfg.ID, folderFs, m.db)
|
||||
|
||||
for _, device := range cfg.Devices {
|
||||
m.folderDevices.set(device.DeviceID, cfg.ID)
|
||||
m.deviceFolders[device.DeviceID] = append(m.deviceFolders[device.DeviceID], cfg.ID)
|
||||
}
|
||||
|
||||
ignores := ignore.New(ignore.WithCache(m.cacheIgnoredFiles))
|
||||
if err := ignores.Load(filepath.Join(cfg.Path(), ".stignore")); err != nil && !os.IsNotExist(err) {
|
||||
ignores := ignore.New(folderFs, ignore.WithCache(m.cacheIgnoredFiles))
|
||||
if err := ignores.Load(".stignore"); err != nil && !fs.IsNotExist(err) {
|
||||
l.Warnln("Loading ignores:", err)
|
||||
}
|
||||
m.folderIgnores[cfg.ID] = ignores
|
||||
@@ -327,8 +335,8 @@ func (m *Model) RemoveFolder(folder string) {
|
||||
|
||||
// Delete syncthing specific files
|
||||
folderCfg := m.folderCfgs[folder]
|
||||
folderPath := folderCfg.Path()
|
||||
os.Remove(filepath.Join(folderPath, ".stfolder"))
|
||||
fs := folderCfg.Filesystem()
|
||||
fs.Remove(".stfolder")
|
||||
|
||||
m.tearDownFolderLocked(folder)
|
||||
// Remove it from the database
|
||||
@@ -533,7 +541,7 @@ func (m *Model) Completion(device protocol.DeviceID, folder string) FolderComple
|
||||
|
||||
// If the completion is 100% but there are deletes we need to handle,
|
||||
// drop it down a notch. Hack for consumers that look only at the
|
||||
// percentage (our own GUI does the same calculation as here on it's own
|
||||
// percentage (our own GUI does the same calculation as here on its own
|
||||
// and needs the same fixup).
|
||||
if need == 0 && deletes > 0 {
|
||||
completionPct = 95 // chosen by fair dice roll
|
||||
@@ -1139,16 +1147,10 @@ func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset
|
||||
}
|
||||
m.fmut.RLock()
|
||||
folderCfg := m.folderCfgs[folder]
|
||||
folderPath := folderCfg.Path()
|
||||
folderIgnores := m.folderIgnores[folder]
|
||||
m.fmut.RUnlock()
|
||||
|
||||
fn, err := rootedJoinedPath(folderPath, name)
|
||||
if err != nil {
|
||||
// Request tries to escape!
|
||||
l.Debugf("%v Invalid REQ(in) tries to escape: %s: %q / %q o=%d s=%d", m, deviceID, folder, name, offset, len(buf))
|
||||
return protocol.ErrInvalid
|
||||
}
|
||||
folderFs := folderCfg.Filesystem()
|
||||
|
||||
// Having passed the rootedJoinedPath check above, we know "name" is
|
||||
// acceptable relative to "folderPath" and in canonical form, so we can
|
||||
@@ -1164,7 +1166,7 @@ func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset
|
||||
return protocol.ErrNoSuchFile
|
||||
}
|
||||
|
||||
if err := osutil.TraversesSymlink(folderPath, filepath.Dir(name)); err != nil {
|
||||
if err := osutil.TraversesSymlink(folderFs, filepath.Dir(name)); err != nil {
|
||||
l.Debugf("%v REQ(in) traversal check: %s - %s: %q / %q o=%d s=%d", m, err, deviceID, folder, name, offset, len(buf))
|
||||
return protocol.ErrNoSuchFile
|
||||
}
|
||||
@@ -1172,29 +1174,29 @@ func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset
|
||||
// Only check temp files if the flag is set, and if we are set to advertise
|
||||
// the temp indexes.
|
||||
if fromTemporary && !folderCfg.DisableTempIndexes {
|
||||
tempFn := filepath.Join(folderPath, ignore.TempName(name))
|
||||
tempFn := ignore.TempName(name)
|
||||
|
||||
if info, err := osutil.Lstat(tempFn); err != nil || !info.Mode().IsRegular() {
|
||||
if info, err := folderFs.Lstat(tempFn); err != nil || !info.IsRegular() {
|
||||
// Reject reads for anything that doesn't exist or is something
|
||||
// other than a regular file.
|
||||
return protocol.ErrNoSuchFile
|
||||
}
|
||||
|
||||
if err := readOffsetIntoBuf(tempFn, offset, buf); err == nil {
|
||||
if err := readOffsetIntoBuf(folderFs, tempFn, offset, buf); err == nil {
|
||||
return nil
|
||||
}
|
||||
// Fall through to reading from a non-temp file, just incase the temp
|
||||
// file has finished downloading.
|
||||
}
|
||||
|
||||
if info, err := osutil.Lstat(fn); err != nil || !info.Mode().IsRegular() {
|
||||
if info, err := folderFs.Lstat(name); err != nil || !info.IsRegular() {
|
||||
// Reject reads for anything that doesn't exist or is something
|
||||
// other than a regular file.
|
||||
return protocol.ErrNoSuchFile
|
||||
}
|
||||
|
||||
err = readOffsetIntoBuf(fn, offset, buf)
|
||||
if os.IsNotExist(err) {
|
||||
err := readOffsetIntoBuf(folderFs, name, offset, buf)
|
||||
if fs.IsNotExist(err) {
|
||||
return protocol.ErrNoSuchFile
|
||||
} else if err != nil {
|
||||
return protocol.ErrGeneric
|
||||
@@ -1245,30 +1247,31 @@ func (m *Model) ConnectedTo(deviceID protocol.DeviceID) bool {
|
||||
|
||||
func (m *Model) GetIgnores(folder string) ([]string, []string, error) {
|
||||
m.fmut.RLock()
|
||||
defer m.fmut.RUnlock()
|
||||
|
||||
cfg, ok := m.folderCfgs[folder]
|
||||
m.fmut.RUnlock()
|
||||
if ok {
|
||||
if !cfg.HasMarker() {
|
||||
return nil, nil, fmt.Errorf("Folder %s stopped", folder)
|
||||
if !ok {
|
||||
cfg, ok = m.cfg.Folders()[folder]
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("Folder %s does not exist", folder)
|
||||
}
|
||||
}
|
||||
|
||||
m.fmut.RLock()
|
||||
ignores := m.folderIgnores[folder]
|
||||
m.fmut.RUnlock()
|
||||
if err := m.checkFolderPath(cfg); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ignores, ok := m.folderIgnores[folder]
|
||||
if ok {
|
||||
return ignores.Lines(), ignores.Patterns(), nil
|
||||
}
|
||||
|
||||
if cfg, ok := m.cfg.Folders()[folder]; ok {
|
||||
matcher := ignore.New()
|
||||
path := filepath.Join(cfg.Path(), ".stignore")
|
||||
if err := matcher.Load(path); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
return matcher.Lines(), matcher.Patterns(), nil
|
||||
ignores = ignore.New(fs.NewFilesystem(cfg.FilesystemType, cfg.Path))
|
||||
if err := ignores.Load(".stignore"); err != nil && !fs.IsNotExist(err) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return nil, nil, fmt.Errorf("Folder %s does not exist", folder)
|
||||
return ignores.Lines(), ignores.Patterns(), nil
|
||||
}
|
||||
|
||||
func (m *Model) SetIgnores(folder string, content []string) error {
|
||||
@@ -1277,7 +1280,7 @@ func (m *Model) SetIgnores(folder string, content []string) error {
|
||||
return fmt.Errorf("Folder %s does not exist", folder)
|
||||
}
|
||||
|
||||
if err := ignore.WriteIgnores(filepath.Join(cfg.Path(), ".stignore"), content); err != nil {
|
||||
if err := ignore.WriteIgnores(cfg.Filesystem(), ".stignore", content); err != nil {
|
||||
l.Warnln("Saving .stignore:", err)
|
||||
return err
|
||||
}
|
||||
@@ -1611,8 +1614,6 @@ func (m *Model) updateLocals(folder string, fs []protocol.FileInfo) {
|
||||
}
|
||||
|
||||
func (m *Model) diskChangeDetected(folderCfg config.FolderConfiguration, files []protocol.FileInfo, typeOfEvent events.EventType) {
|
||||
path := strings.Replace(folderCfg.Path(), `\\?\`, "", 1)
|
||||
|
||||
for _, file := range files {
|
||||
objType := "file"
|
||||
action := "modified"
|
||||
@@ -1635,10 +1636,6 @@ func (m *Model) diskChangeDetected(folderCfg config.FolderConfiguration, files [
|
||||
action = "deleted"
|
||||
}
|
||||
|
||||
// The full file path, adjusted to the local path separator character. Also
|
||||
// for windows paths, strip unwanted chars from the front.
|
||||
path := filepath.Join(path, filepath.FromSlash(file.Name))
|
||||
|
||||
// Two different events can be fired here based on what EventType is passed into function
|
||||
events.Default.Log(typeOfEvent, map[string]string{
|
||||
"folder": folderCfg.ID,
|
||||
@@ -1646,7 +1643,7 @@ func (m *Model) diskChangeDetected(folderCfg config.FolderConfiguration, files [
|
||||
"label": folderCfg.Label,
|
||||
"action": action,
|
||||
"type": objType,
|
||||
"path": path,
|
||||
"path": filepath.FromSlash(file.Name),
|
||||
"modifiedBy": file.ModifiedBy.String(),
|
||||
})
|
||||
}
|
||||
@@ -1739,20 +1736,17 @@ func (m *Model) internalScanFolderSubdirs(ctx context.Context, folder string, su
|
||||
// not relevant, we just want the dotdot escape detection here. For
|
||||
// historical reasons we may get paths that end in a slash. We
|
||||
// remove that first to allow the rootedJoinedPath to pass.
|
||||
sub = strings.TrimRight(sub, string(os.PathSeparator))
|
||||
if _, err := rootedJoinedPath("root", sub); err != nil {
|
||||
return errors.New("invalid subpath")
|
||||
}
|
||||
sub = strings.TrimRight(sub, string(fs.PathSeparator))
|
||||
subDirs[i] = sub
|
||||
}
|
||||
|
||||
m.fmut.Lock()
|
||||
fs := m.folderFiles[folder]
|
||||
fset := m.folderFiles[folder]
|
||||
folderCfg := m.folderCfgs[folder]
|
||||
ignores := m.folderIgnores[folder]
|
||||
runner, ok := m.folderRunners[folder]
|
||||
m.fmut.Unlock()
|
||||
mtimefs := fs.MtimeFS()
|
||||
mtimefs := fset.MtimeFS()
|
||||
|
||||
// Check if the ignore patterns changed as part of scanning this folder.
|
||||
// If they did we should schedule a pull of the folder so that we
|
||||
@@ -1779,7 +1773,7 @@ func (m *Model) internalScanFolderSubdirs(ctx context.Context, folder string, su
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ignores.Load(filepath.Join(folderCfg.Path(), ".stignore")); err != nil && !os.IsNotExist(err) {
|
||||
if err := ignores.Load(".stignore"); err != nil && !fs.IsNotExist(err) {
|
||||
err = fmt.Errorf("loading ignores: %v", err)
|
||||
runner.setError(err)
|
||||
l.Infof("Stopping folder %s due to error: %s", folderCfg.Description(), err)
|
||||
@@ -1790,7 +1784,7 @@ func (m *Model) internalScanFolderSubdirs(ctx context.Context, folder string, su
|
||||
// directory, and don't scan subdirectories of things we've already
|
||||
// scanned.
|
||||
subDirs = unifySubs(subDirs, func(f string) bool {
|
||||
_, ok := fs.Get(protocol.LocalDeviceID, f)
|
||||
_, ok := fset.Get(protocol.LocalDeviceID, f)
|
||||
return ok
|
||||
})
|
||||
|
||||
@@ -1798,7 +1792,6 @@ func (m *Model) internalScanFolderSubdirs(ctx context.Context, folder string, su
|
||||
|
||||
fchan, err := scanner.Walk(ctx, scanner.Config{
|
||||
Folder: folderCfg.ID,
|
||||
Dir: folderCfg.Path(),
|
||||
Subs: subDirs,
|
||||
Matcher: ignores,
|
||||
BlockSize: protocol.BlockSize,
|
||||
@@ -1861,7 +1854,7 @@ func (m *Model) internalScanFolderSubdirs(ctx context.Context, folder string, su
|
||||
for _, sub := range subDirs {
|
||||
var iterError error
|
||||
|
||||
fs.WithPrefixedHaveTruncated(protocol.LocalDeviceID, sub, func(fi db.FileIntf) bool {
|
||||
fset.WithPrefixedHaveTruncated(protocol.LocalDeviceID, sub, func(fi db.FileIntf) bool {
|
||||
f := fi.(db.FileInfoTruncated)
|
||||
if len(batch) == maxBatchSizeFiles || batchSizeBytes > maxBatchSizeBytes {
|
||||
if err := m.CheckFolderHealth(folder); err != nil {
|
||||
@@ -1896,9 +1889,9 @@ func (m *Model) internalScanFolderSubdirs(ctx context.Context, folder string, su
|
||||
// The file is valid and not deleted. Lets check if it's
|
||||
// still here.
|
||||
|
||||
if _, err := mtimefs.Lstat(filepath.Join(folderCfg.Path(), f.Name)); err != nil {
|
||||
if _, err := mtimefs.Lstat(f.Name); err != nil {
|
||||
// We don't specifically verify that the error is
|
||||
// os.IsNotExist because there is a corner case when a
|
||||
// fs.IsNotExist because there is a corner case when a
|
||||
// directory is suddenly transformed into a file. When that
|
||||
// happens, files that were in the directory (that is now a
|
||||
// file) are deleted but will return a confusing error ("not a
|
||||
@@ -2276,11 +2269,9 @@ func (m *Model) CheckFolderHealth(id string) error {
|
||||
|
||||
// checkFolderPath returns nil if the folder path exists and has the marker file.
|
||||
func (m *Model) checkFolderPath(folder config.FolderConfiguration) error {
|
||||
if folder.Path() == "" {
|
||||
return errFolderPathEmpty
|
||||
}
|
||||
fs := folder.Filesystem()
|
||||
|
||||
if fi, err := os.Stat(folder.Path()); err != nil || !fi.IsDir() {
|
||||
if fi, err := fs.Stat("."); err != nil || !fi.IsDir() {
|
||||
return errFolderPathMissing
|
||||
}
|
||||
|
||||
@@ -2294,30 +2285,31 @@ func (m *Model) checkFolderPath(folder config.FolderConfiguration) error {
|
||||
// checkFolderFreeSpace returns nil if the folder has the required amount of
|
||||
// free space, or if folder free space checking is disabled.
|
||||
func (m *Model) checkFolderFreeSpace(folder config.FolderConfiguration) error {
|
||||
return m.checkFreeSpace(folder.MinDiskFree, folder.Path())
|
||||
return m.checkFreeSpace(folder.MinDiskFree, folder.Filesystem())
|
||||
}
|
||||
|
||||
// checkHomeDiskFree returns nil if the home disk has the required amount of
|
||||
// free space, or if home disk free space checking is disabled.
|
||||
func (m *Model) checkHomeDiskFree() error {
|
||||
return m.checkFreeSpace(m.cfg.Options().MinHomeDiskFree, m.cfg.ConfigPath())
|
||||
fs := fs.NewFilesystem(fs.FilesystemTypeBasic, filepath.Dir(m.cfg.ConfigPath()))
|
||||
return m.checkFreeSpace(m.cfg.Options().MinHomeDiskFree, fs)
|
||||
}
|
||||
|
||||
func (m *Model) checkFreeSpace(req config.Size, path string) error {
|
||||
func (m *Model) checkFreeSpace(req config.Size, fs fs.Filesystem) error {
|
||||
val := req.BaseValue()
|
||||
if val <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
usage, err := fs.Usage(".")
|
||||
if req.Percentage() {
|
||||
free, err := osutil.DiskFreePercentage(path)
|
||||
if err == nil && free < val {
|
||||
return fmt.Errorf("insufficient space in %v: %f %% < %v", path, free, req)
|
||||
freePct := (float64(usage.Free) / float64(usage.Total)) * 100
|
||||
if err == nil && freePct < val {
|
||||
return fmt.Errorf("insufficient space in %v %v: %f %% < %v", fs.Type(), fs.URI(), freePct, req)
|
||||
}
|
||||
} else {
|
||||
free, err := osutil.DiskFreeBytes(path)
|
||||
if err == nil && float64(free) < val {
|
||||
return fmt.Errorf("insufficient space in %v: %v < %v", path, free, req)
|
||||
if err == nil && float64(usage.Free) < val {
|
||||
return fmt.Errorf("insufficient space in %v %v: %v < %v", fs.Type(), fs.URI(), usage.Free, req)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2534,8 +2526,8 @@ func stringSliceWithout(ss []string, s string) []string {
|
||||
return ss
|
||||
}
|
||||
|
||||
func readOffsetIntoBuf(file string, offset int64, buf []byte) error {
|
||||
fd, err := os.Open(file)
|
||||
func readOffsetIntoBuf(fs fs.Filesystem, file string, offset int64, buf []byte) error {
|
||||
fd, err := fs.Open(file)
|
||||
if err != nil {
|
||||
l.Debugln("readOffsetIntoBuf.Open", file, err)
|
||||
return err
|
||||
@@ -2586,7 +2578,7 @@ func simplifySortedPaths(subs []string) []string {
|
||||
next:
|
||||
for _, sub := range subs {
|
||||
for _, existing := range cleaned {
|
||||
if sub == existing || strings.HasPrefix(sub, existing+string(os.PathSeparator)) {
|
||||
if sub == existing || strings.HasPrefix(sub, existing+string(fs.PathSeparator)) {
|
||||
continue next
|
||||
}
|
||||
}
|
||||
@@ -2667,57 +2659,3 @@ func (s folderDeviceSet) sortedDevices(folder string) []protocol.DeviceID {
|
||||
sort.Sort(protocol.DeviceIDs(devs))
|
||||
return devs
|
||||
}
|
||||
|
||||
// rootedJoinedPath takes a root and a supposedly relative path inside that
|
||||
// root and returns the joined path. An error is returned if the joined path
|
||||
// is not in fact inside the root.
|
||||
func rootedJoinedPath(root, rel string) (string, error) {
|
||||
// The root must not be empty.
|
||||
if root == "" {
|
||||
return "", errInvalidFilename
|
||||
}
|
||||
|
||||
pathSep := string(os.PathSeparator)
|
||||
|
||||
// The expected prefix for the resulting path is the root, with a path
|
||||
// separator at the end.
|
||||
expectedPrefix := filepath.FromSlash(root)
|
||||
if !strings.HasSuffix(expectedPrefix, pathSep) {
|
||||
expectedPrefix += pathSep
|
||||
}
|
||||
|
||||
// The relative path should be clean from internal dotdots and similar
|
||||
// funkyness.
|
||||
rel = filepath.FromSlash(rel)
|
||||
if filepath.Clean(rel) != rel {
|
||||
return "", errInvalidFilename
|
||||
}
|
||||
|
||||
// It is not acceptable to attempt to traverse upwards or refer to the
|
||||
// root itself.
|
||||
switch rel {
|
||||
case ".", "..", pathSep:
|
||||
return "", errNotRelative
|
||||
}
|
||||
if strings.HasPrefix(rel, ".."+pathSep) {
|
||||
return "", errNotRelative
|
||||
}
|
||||
|
||||
if strings.HasPrefix(rel, pathSep+pathSep) {
|
||||
// The relative path may pretend to be an absolute path within the
|
||||
// root, but the double path separator on Windows implies something
|
||||
// else. It would get cleaned by the Join below, but it's out of
|
||||
// spec anyway.
|
||||
return "", errNotRelative
|
||||
}
|
||||
|
||||
// The supposedly correct path is the one filepath.Join will return, as
|
||||
// it does cleaning and so on. Check that one first to make sure no
|
||||
// obvious escape attempts have been made.
|
||||
joined := filepath.Join(root, rel)
|
||||
if !strings.HasPrefix(joined, expectedPrefix) {
|
||||
return "", errNotRelative
|
||||
}
|
||||
|
||||
return joined, nil
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ import (
|
||||
"github.com/d4l3k/messagediff"
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/ignore"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
srand "github.com/syncthing/syncthing/lib/rand"
|
||||
"github.com/syncthing/syncthing/lib/scanner"
|
||||
@@ -35,12 +35,14 @@ import (
|
||||
var device1, device2 protocol.DeviceID
|
||||
var defaultConfig *config.Wrapper
|
||||
var defaultFolderConfig config.FolderConfiguration
|
||||
var defaultFs fs.Filesystem
|
||||
|
||||
func init() {
|
||||
device1, _ = protocol.DeviceIDFromString("AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR")
|
||||
device2, _ = protocol.DeviceIDFromString("GYRZZQB-IRNPV4Z-T7TC52W-EQYJ3TT-FDQW6MW-DFLMU42-SSSU6EM-FBK2VAY")
|
||||
defaultFs = fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata")
|
||||
|
||||
defaultFolderConfig = config.NewFolderConfiguration("default", "testdata")
|
||||
defaultFolderConfig = config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, "testdata")
|
||||
defaultFolderConfig.Devices = []config.FolderDeviceConfiguration{{DeviceID: device1}}
|
||||
_defaultConfig := config.Configuration{
|
||||
Folders: []config.FolderConfiguration{defaultFolderConfig},
|
||||
@@ -350,6 +352,24 @@ func (f *fakeConnection) addFile(name string, flags uint32, ftype protocol.FileI
|
||||
f.fileData[name] = data
|
||||
}
|
||||
|
||||
func (f *fakeConnection) deleteFile(name string) {
|
||||
f.mut.Lock()
|
||||
defer f.mut.Unlock()
|
||||
|
||||
for i, fi := range f.files {
|
||||
if fi.Name == name {
|
||||
fi.Deleted = true
|
||||
fi.ModifiedS = time.Now().Unix()
|
||||
fi.Version = fi.Version.Update(f.id.Short())
|
||||
fi.Sequence = time.Now().UnixNano()
|
||||
fi.Blocks = nil
|
||||
|
||||
f.files = append(append(f.files[:i], f.files[i+1:]...), fi)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fakeConnection) sendIndexUpdate() {
|
||||
f.model.IndexUpdate(f.id, f.folder, f.files)
|
||||
}
|
||||
@@ -495,14 +515,16 @@ func TestClusterConfig(t *testing.T) {
|
||||
}
|
||||
cfg.Folders = []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2},
|
||||
@@ -604,13 +626,15 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
},
|
||||
@@ -653,14 +677,16 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
},
|
||||
@@ -708,14 +734,16 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
@@ -753,14 +781,16 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
@@ -798,14 +828,16 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
},
|
||||
@@ -854,14 +886,16 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2},
|
||||
@@ -898,14 +932,16 @@ func TestIntroducer(t *testing.T) {
|
||||
},
|
||||
Folders: []config.FolderConfiguration{
|
||||
{
|
||||
ID: "folder1",
|
||||
ID: "folder1",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: device1},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "folder2",
|
||||
ID: "folder2",
|
||||
Path: "testdata",
|
||||
Devices: []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2, IntroducedBy: protocol.LocalDeviceID},
|
||||
@@ -1008,7 +1044,7 @@ func TestIgnores(t *testing.T) {
|
||||
// because we will be changing the files on disk often enough that the
|
||||
// mtimes will be unreliable to determine change status.
|
||||
m.fmut.Lock()
|
||||
m.folderIgnores["default"] = ignore.New(ignore.WithCache(true), ignore.WithChangeDetector(newAlwaysChanged()))
|
||||
m.folderIgnores["default"] = ignore.New(defaultFs, ignore.WithCache(true), ignore.WithChangeDetector(newAlwaysChanged()))
|
||||
m.fmut.Unlock()
|
||||
|
||||
// Make sure the initial scan has finished (ScanFolders is blocking)
|
||||
@@ -1032,7 +1068,7 @@ func TestIgnores(t *testing.T) {
|
||||
}
|
||||
|
||||
// Invalid path, marker should be missing, hence returns an error.
|
||||
m.AddFolder(config.FolderConfiguration{ID: "fresh", RawPath: "XXX"})
|
||||
m.AddFolder(config.FolderConfiguration{ID: "fresh", Path: "XXX"})
|
||||
_, _, err = m.GetIgnores("fresh")
|
||||
if err == nil {
|
||||
t.Error("No error")
|
||||
@@ -1047,18 +1083,23 @@ func TestIgnores(t *testing.T) {
|
||||
// added to the model and thus there is no initial scan happening.
|
||||
|
||||
changeIgnores(t, m, expected)
|
||||
|
||||
// Make sure no .stignore file is considered valid
|
||||
os.Rename("testdata/.stignore", "testdata/.stignore.bak")
|
||||
changeIgnores(t, m, []string{})
|
||||
os.Rename("testdata/.stignore.bak", "testdata/.stignore")
|
||||
}
|
||||
|
||||
func TestROScanRecovery(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
set := db.NewFileSet("default", ldb)
|
||||
set := db.NewFileSet("default", defaultFs, ldb)
|
||||
set.Update(protocol.LocalDeviceID, []protocol.FileInfo{
|
||||
{Name: "dummyfile"},
|
||||
})
|
||||
|
||||
fcfg := config.FolderConfiguration{
|
||||
ID: "default",
|
||||
RawPath: "testdata/rotestfolder",
|
||||
Path: "testdata/rotestfolder",
|
||||
Type: config.FolderTypeSendOnly,
|
||||
RescanIntervalS: 1,
|
||||
}
|
||||
@@ -1071,7 +1112,7 @@ func TestROScanRecovery(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
os.RemoveAll(fcfg.RawPath)
|
||||
os.RemoveAll(fcfg.Path)
|
||||
|
||||
m := NewModel(cfg, protocol.LocalDeviceID, "syncthing", "dev", ldb, nil)
|
||||
m.AddFolder(fcfg)
|
||||
@@ -1102,14 +1143,14 @@ func TestROScanRecovery(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
os.Mkdir(fcfg.RawPath, 0700)
|
||||
os.Mkdir(fcfg.Path, 0700)
|
||||
|
||||
if err := waitFor("folder marker missing"); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fd, err := os.Create(filepath.Join(fcfg.RawPath, ".stfolder"))
|
||||
fd, err := os.Create(filepath.Join(fcfg.Path, ".stfolder"))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
@@ -1121,14 +1162,14 @@ func TestROScanRecovery(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
os.Remove(filepath.Join(fcfg.RawPath, ".stfolder"))
|
||||
os.Remove(filepath.Join(fcfg.Path, ".stfolder"))
|
||||
|
||||
if err := waitFor("folder marker missing"); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
os.Remove(fcfg.RawPath)
|
||||
os.Remove(fcfg.Path)
|
||||
|
||||
if err := waitFor("folder path missing"); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1138,14 +1179,14 @@ func TestROScanRecovery(t *testing.T) {
|
||||
|
||||
func TestRWScanRecovery(t *testing.T) {
|
||||
ldb := db.OpenMemory()
|
||||
set := db.NewFileSet("default", ldb)
|
||||
set := db.NewFileSet("default", defaultFs, ldb)
|
||||
set.Update(protocol.LocalDeviceID, []protocol.FileInfo{
|
||||
{Name: "dummyfile"},
|
||||
})
|
||||
|
||||
fcfg := config.FolderConfiguration{
|
||||
ID: "default",
|
||||
RawPath: "testdata/rwtestfolder",
|
||||
Path: "testdata/rwtestfolder",
|
||||
Type: config.FolderTypeSendReceive,
|
||||
RescanIntervalS: 1,
|
||||
}
|
||||
@@ -1158,7 +1199,7 @@ func TestRWScanRecovery(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
os.RemoveAll(fcfg.RawPath)
|
||||
os.RemoveAll(fcfg.Path)
|
||||
|
||||
m := NewModel(cfg, protocol.LocalDeviceID, "syncthing", "dev", ldb, nil)
|
||||
m.AddFolder(fcfg)
|
||||
@@ -1189,14 +1230,14 @@ func TestRWScanRecovery(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
os.Mkdir(fcfg.RawPath, 0700)
|
||||
os.Mkdir(fcfg.Path, 0700)
|
||||
|
||||
if err := waitFor("folder marker missing"); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fd, err := os.Create(filepath.Join(fcfg.RawPath, ".stfolder"))
|
||||
fd, err := os.Create(filepath.Join(fcfg.Path, ".stfolder"))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
@@ -1208,14 +1249,14 @@ func TestRWScanRecovery(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
os.Remove(filepath.Join(fcfg.RawPath, ".stfolder"))
|
||||
os.Remove(filepath.Join(fcfg.Path, ".stfolder"))
|
||||
|
||||
if err := waitFor("folder marker missing"); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
os.Remove(fcfg.RawPath)
|
||||
os.Remove(fcfg.Path)
|
||||
|
||||
if err := waitFor("folder path missing"); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1843,14 +1884,14 @@ func TestIssue3164(t *testing.T) {
|
||||
f := protocol.FileInfo{
|
||||
Name: "issue3164",
|
||||
}
|
||||
m := ignore.New()
|
||||
m := ignore.New(defaultFs)
|
||||
if err := m.Parse(bytes.NewBufferString("(?d)oktodelete"), ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fl := sendReceiveFolder{
|
||||
dbUpdates: make(chan dbUpdateJob, 1),
|
||||
dir: "testdata",
|
||||
fs: fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata"),
|
||||
}
|
||||
|
||||
fl.deleteDir(f, m)
|
||||
@@ -1937,7 +1978,7 @@ func TestIssue2782(t *testing.T) {
|
||||
if err := os.RemoveAll(testDir); err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
if err := osutil.MkdirAll(testDir+"/syncdir", 0755); err != nil {
|
||||
if err := os.MkdirAll(testDir+"/syncdir", 0755); err != nil {
|
||||
t.Skip(err)
|
||||
}
|
||||
if err := ioutil.WriteFile(testDir+"/syncdir/file", []byte("hello, world\n"), 0644); err != nil {
|
||||
@@ -1950,7 +1991,7 @@ func TestIssue2782(t *testing.T) {
|
||||
|
||||
db := db.OpenMemory()
|
||||
m := NewModel(defaultConfig, protocol.LocalDeviceID, "syncthing", "dev", db, nil)
|
||||
m.AddFolder(config.NewFolderConfiguration("default", "~/"+testName+"/synclink/"))
|
||||
m.AddFolder(config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, "~/"+testName+"/synclink/"))
|
||||
m.StartFolder("default")
|
||||
m.ServeBackground()
|
||||
defer m.Stop()
|
||||
@@ -1967,7 +2008,7 @@ func TestIssue2782(t *testing.T) {
|
||||
func TestIndexesForUnknownDevicesDropped(t *testing.T) {
|
||||
dbi := db.OpenMemory()
|
||||
|
||||
files := db.NewFileSet("default", dbi)
|
||||
files := db.NewFileSet("default", defaultFs, dbi)
|
||||
files.Replace(device1, genFiles(1))
|
||||
files.Replace(device2, genFiles(1))
|
||||
|
||||
@@ -1980,7 +2021,7 @@ func TestIndexesForUnknownDevicesDropped(t *testing.T) {
|
||||
m.StartFolder("default")
|
||||
|
||||
// Remote sequence is cached, hence need to recreated.
|
||||
files = db.NewFileSet("default", dbi)
|
||||
files = db.NewFileSet("default", defaultFs, dbi)
|
||||
|
||||
if len(files.ListDevices()) != 1 {
|
||||
t.Error("Expected one device")
|
||||
@@ -1990,7 +2031,7 @@ func TestIndexesForUnknownDevicesDropped(t *testing.T) {
|
||||
func TestSharedWithClearedOnDisconnect(t *testing.T) {
|
||||
dbi := db.OpenMemory()
|
||||
|
||||
fcfg := config.NewFolderConfiguration("default", "testdata")
|
||||
fcfg := config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, "testdata")
|
||||
fcfg.Devices = []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2},
|
||||
@@ -2229,7 +2270,7 @@ func TestNoRequestsFromPausedDevices(t *testing.T) {
|
||||
|
||||
dbi := db.OpenMemory()
|
||||
|
||||
fcfg := config.NewFolderConfiguration("default", "testdata")
|
||||
fcfg := config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, "testdata")
|
||||
fcfg.Devices = []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2},
|
||||
@@ -2317,151 +2358,6 @@ func TestNoRequestsFromPausedDevices(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootedJoinedPath(t *testing.T) {
|
||||
type testcase struct {
|
||||
root string
|
||||
rel string
|
||||
joined string
|
||||
ok bool
|
||||
}
|
||||
cases := []testcase{
|
||||
// Valid cases
|
||||
{"foo", "bar", "foo/bar", true},
|
||||
{"foo", "/bar", "foo/bar", true},
|
||||
{"foo/", "bar", "foo/bar", true},
|
||||
{"foo/", "/bar", "foo/bar", true},
|
||||
{"baz/foo", "bar", "baz/foo/bar", true},
|
||||
{"baz/foo", "/bar", "baz/foo/bar", true},
|
||||
{"baz/foo/", "bar", "baz/foo/bar", true},
|
||||
{"baz/foo/", "/bar", "baz/foo/bar", true},
|
||||
{"foo", "bar/baz", "foo/bar/baz", true},
|
||||
{"foo", "/bar/baz", "foo/bar/baz", true},
|
||||
{"foo/", "bar/baz", "foo/bar/baz", true},
|
||||
{"foo/", "/bar/baz", "foo/bar/baz", true},
|
||||
{"baz/foo", "bar/baz", "baz/foo/bar/baz", true},
|
||||
{"baz/foo", "/bar/baz", "baz/foo/bar/baz", true},
|
||||
{"baz/foo/", "bar/baz", "baz/foo/bar/baz", true},
|
||||
{"baz/foo/", "/bar/baz", "baz/foo/bar/baz", true},
|
||||
|
||||
// Not escape attempts, but oddly formatted relative paths. Disallowed.
|
||||
{"foo", "./bar", "", false},
|
||||
{"baz/foo", "./bar", "", false},
|
||||
{"foo", "./bar/baz", "", false},
|
||||
{"baz/foo", "./bar/baz", "", false},
|
||||
{"baz/foo", "bar/../baz", "", false},
|
||||
{"baz/foo", "/bar/../baz", "", false},
|
||||
{"baz/foo", "./bar/../baz", "", false},
|
||||
{"baz/foo", "bar/../baz", "", false},
|
||||
{"baz/foo", "/bar/../baz", "", false},
|
||||
{"baz/foo", "./bar/../baz", "", false},
|
||||
|
||||
// Results in an allowed path, but does it by probing. Disallowed.
|
||||
{"foo", "../foo", "", false},
|
||||
{"foo", "../foo/bar", "", false},
|
||||
{"baz/foo", "../foo/bar", "", false},
|
||||
{"baz/foo", "../../baz/foo/bar", "", false},
|
||||
{"baz/foo", "bar/../../foo/bar", "", false},
|
||||
{"baz/foo", "bar/../../../baz/foo/bar", "", false},
|
||||
|
||||
// Escape attempts.
|
||||
{"foo", "", "", false},
|
||||
{"foo", "/", "", false},
|
||||
{"foo", "..", "", false},
|
||||
{"foo", "/..", "", false},
|
||||
{"foo", "../", "", false},
|
||||
{"foo", "../bar", "", false},
|
||||
{"foo", "../foobar", "", false},
|
||||
{"foo/", "../bar", "", false},
|
||||
{"foo/", "../foobar", "", false},
|
||||
{"baz/foo", "../bar", "", false},
|
||||
{"baz/foo", "../foobar", "", false},
|
||||
{"baz/foo/", "../bar", "", false},
|
||||
{"baz/foo/", "../foobar", "", false},
|
||||
{"baz/foo/", "bar/../../quux/baz", "", false},
|
||||
|
||||
// Empty root is a misconfiguration.
|
||||
{"", "/foo", "", false},
|
||||
{"", "foo", "", false},
|
||||
{"", ".", "", false},
|
||||
{"", "..", "", false},
|
||||
{"", "/", "", false},
|
||||
{"", "", "", false},
|
||||
|
||||
// Root=/ is valid, and things should be verified as usual.
|
||||
{"/", "foo", "/foo", true},
|
||||
{"/", "/foo", "/foo", true},
|
||||
{"/", "../foo", "", false},
|
||||
{"/", ".", "", false},
|
||||
{"/", "..", "", false},
|
||||
{"/", "/", "", false},
|
||||
{"/", "", "", false},
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
extraCases := []testcase{
|
||||
{`c:\`, `foo`, `c:\foo`, true},
|
||||
{`\\?\c:\`, `foo`, `\\?\c:\foo`, true},
|
||||
{`c:\`, `\foo`, `c:\foo`, true},
|
||||
{`\\?\c:\`, `\foo`, `\\?\c:\foo`, true},
|
||||
|
||||
{`c:\`, `\\foo`, ``, false},
|
||||
{`c:\`, ``, ``, false},
|
||||
{`c:\`, `.`, ``, false},
|
||||
{`c:\`, `\`, ``, false},
|
||||
{`\\?\c:\`, `\\foo`, ``, false},
|
||||
{`\\?\c:\`, ``, ``, false},
|
||||
{`\\?\c:\`, `.`, ``, false},
|
||||
{`\\?\c:\`, `\`, ``, false},
|
||||
|
||||
// makes no sense, but will be treated simply as a bad filename
|
||||
{`c:\foo`, `d:\bar`, `c:\foo\d:\bar`, true},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
// Add case where root is backslashed, rel is forward slashed
|
||||
extraCases = append(extraCases, testcase{
|
||||
root: filepath.FromSlash(tc.root),
|
||||
rel: tc.rel,
|
||||
joined: tc.joined,
|
||||
ok: tc.ok,
|
||||
})
|
||||
// and the opposite
|
||||
extraCases = append(extraCases, testcase{
|
||||
root: tc.root,
|
||||
rel: filepath.FromSlash(tc.rel),
|
||||
joined: tc.joined,
|
||||
ok: tc.ok,
|
||||
})
|
||||
// and both backslashed
|
||||
extraCases = append(extraCases, testcase{
|
||||
root: filepath.FromSlash(tc.root),
|
||||
rel: filepath.FromSlash(tc.rel),
|
||||
joined: tc.joined,
|
||||
ok: tc.ok,
|
||||
})
|
||||
}
|
||||
|
||||
cases = append(cases, extraCases...)
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
res, err := rootedJoinedPath(tc.root, tc.rel)
|
||||
if tc.ok {
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error for rootedJoinedPath(%q, %q): %v", tc.root, tc.rel, err)
|
||||
continue
|
||||
}
|
||||
exp := filepath.FromSlash(tc.joined)
|
||||
if res != exp {
|
||||
t.Errorf("Unexpected result for rootedJoinedPath(%q, %q): %q != expected %q", tc.root, tc.rel, res, exp)
|
||||
}
|
||||
} else if err == nil {
|
||||
t.Errorf("Unexpected pass for rootedJoinedPath(%q, %q) => %q", tc.root, tc.rel, res)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addFakeConn(m *Model, dev protocol.DeviceID) *fakeConnection {
|
||||
fc := &fakeConnection{id: dev, model: m}
|
||||
m.AddConnection(fc, protocol.HelloResult{})
|
||||
@@ -2491,27 +2387,32 @@ func (fakeAddr) String() string {
|
||||
return "address"
|
||||
}
|
||||
|
||||
type alwaysChangedKey struct {
|
||||
fs fs.Filesystem
|
||||
name string
|
||||
}
|
||||
|
||||
// alwaysChanges is an ignore.ChangeDetector that always returns true on Changed()
|
||||
type alwaysChanged struct {
|
||||
seen map[string]struct{}
|
||||
seen map[alwaysChangedKey]struct{}
|
||||
}
|
||||
|
||||
func newAlwaysChanged() *alwaysChanged {
|
||||
return &alwaysChanged{
|
||||
seen: make(map[string]struct{}),
|
||||
seen: make(map[alwaysChangedKey]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Remember(name string, _ time.Time) {
|
||||
c.seen[name] = struct{}{}
|
||||
func (c *alwaysChanged) Remember(fs fs.Filesystem, name string, _ time.Time) {
|
||||
c.seen[alwaysChangedKey{fs, name}] = struct{}{}
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Reset() {
|
||||
c.seen = make(map[string]struct{})
|
||||
c.seen = make(map[alwaysChangedKey]struct{})
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Seen(name string) bool {
|
||||
_, ok := c.seen[name]
|
||||
func (c *alwaysChanged) Seen(fs fs.Filesystem, name string) bool {
|
||||
_, ok := c.seen[alwaysChangedKey{fs, name}]
|
||||
return ok
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -17,6 +18,7 @@ import (
|
||||
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
)
|
||||
|
||||
@@ -204,9 +206,89 @@ func TestRequestCreateTmpSymlink(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequestVersioningSymlinkAttack(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("no symlink support on Windows")
|
||||
}
|
||||
|
||||
// Sets up a folder with trashcan versioning and tries to use a
|
||||
// deleted symlink to escape
|
||||
|
||||
cfg := defaultConfig.RawCopy()
|
||||
cfg.Folders[0] = config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, "_tmpfolder")
|
||||
cfg.Folders[0].PullerSleepS = 1
|
||||
cfg.Folders[0].Devices = []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
{DeviceID: device2},
|
||||
}
|
||||
cfg.Folders[0].Versioning = config.VersioningConfiguration{
|
||||
Type: "trashcan",
|
||||
}
|
||||
w := config.Wrap("/tmp/cfg", cfg)
|
||||
|
||||
db := db.OpenMemory()
|
||||
m := NewModel(w, device1, "syncthing", "dev", db, nil)
|
||||
m.AddFolder(cfg.Folders[0])
|
||||
m.ServeBackground()
|
||||
m.StartFolder("default")
|
||||
defer m.Stop()
|
||||
|
||||
defer os.RemoveAll("_tmpfolder")
|
||||
|
||||
fc := addFakeConn(m, device2)
|
||||
fc.folder = "default"
|
||||
|
||||
// Create a temporary directory that we will use as target to see if
|
||||
// we can escape to it
|
||||
tmpdir, err := ioutil.TempDir("", "syncthing-test")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// We listen for incoming index updates and trigger when we see one for
|
||||
// the expected test file.
|
||||
idx := make(chan int)
|
||||
fc.mut.Lock()
|
||||
fc.indexFn = func(folder string, fs []protocol.FileInfo) {
|
||||
idx <- len(fs)
|
||||
}
|
||||
fc.mut.Unlock()
|
||||
|
||||
// Send an update for the test file, wait for it to sync and be reported back.
|
||||
fc.addFile("foo", 0644, protocol.FileInfoTypeSymlink, []byte(tmpdir))
|
||||
fc.sendIndexUpdate()
|
||||
|
||||
for updates := 0; updates < 1; updates += <-idx {
|
||||
}
|
||||
|
||||
// Delete the symlink, hoping for it to get versioned
|
||||
fc.deleteFile("foo")
|
||||
fc.sendIndexUpdate()
|
||||
for updates := 0; updates < 1; updates += <-idx {
|
||||
}
|
||||
|
||||
// Recreate foo and a file in it with some data
|
||||
fc.addFile("foo", 0755, protocol.FileInfoTypeDirectory, nil)
|
||||
fc.addFile("foo/test", 0644, protocol.FileInfoTypeFile, []byte("testtesttest"))
|
||||
fc.sendIndexUpdate()
|
||||
for updates := 0; updates < 1; updates += <-idx {
|
||||
}
|
||||
|
||||
// Remove the test file and see if it escaped
|
||||
fc.deleteFile("foo/test")
|
||||
fc.sendIndexUpdate()
|
||||
for updates := 0; updates < 1; updates += <-idx {
|
||||
}
|
||||
|
||||
path := filepath.Join(tmpdir, "test")
|
||||
if _, err := os.Lstat(path); !os.IsNotExist(err) {
|
||||
t.Fatal("File escaped to", path)
|
||||
}
|
||||
}
|
||||
|
||||
func setupModelWithConnection() (*Model, *fakeConnection) {
|
||||
cfg := defaultConfig.RawCopy()
|
||||
cfg.Folders[0] = config.NewFolderConfiguration("default", "_tmpfolder")
|
||||
cfg.Folders[0] = config.NewFolderConfiguration("default", fs.FilesystemTypeBasic, "_tmpfolder")
|
||||
cfg.Folders[0].PullerSleepS = 1
|
||||
cfg.Folders[0].Devices = []config.FolderDeviceConfiguration{
|
||||
{DeviceID: device1},
|
||||
|
||||
@@ -24,7 +24,7 @@ type sendOnlyFolder struct {
|
||||
config.FolderConfiguration
|
||||
}
|
||||
|
||||
func newSendOnlyFolder(model *Model, cfg config.FolderConfiguration, _ versioner.Versioner, _ *fs.MtimeFS) service {
|
||||
func newSendOnlyFolder(model *Model, cfg config.FolderConfiguration, _ versioner.Versioner, _ fs.Filesystem) service {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
return &sendOnlyFolder{
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
@@ -51,7 +50,7 @@ type copyBlocksState struct {
|
||||
}
|
||||
|
||||
// Which filemode bits to preserve
|
||||
const retainBits = os.ModeSetgid | os.ModeSetuid | os.ModeSticky
|
||||
const retainBits = fs.ModeSetgid | fs.ModeSetuid | fs.ModeSticky
|
||||
|
||||
var (
|
||||
activity = newDeviceActivity()
|
||||
@@ -84,8 +83,7 @@ type sendReceiveFolder struct {
|
||||
folder
|
||||
config.FolderConfiguration
|
||||
|
||||
mtimeFS *fs.MtimeFS
|
||||
dir string
|
||||
fs fs.Filesystem
|
||||
versioner versioner.Versioner
|
||||
sleep time.Duration
|
||||
pause time.Duration
|
||||
@@ -99,7 +97,7 @@ type sendReceiveFolder struct {
|
||||
errorsMut sync.Mutex
|
||||
}
|
||||
|
||||
func newSendReceiveFolder(model *Model, cfg config.FolderConfiguration, ver versioner.Versioner, mtimeFS *fs.MtimeFS) service {
|
||||
func newSendReceiveFolder(model *Model, cfg config.FolderConfiguration, ver versioner.Versioner, fs fs.Filesystem) service {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
f := &sendReceiveFolder{
|
||||
@@ -113,8 +111,7 @@ func newSendReceiveFolder(model *Model, cfg config.FolderConfiguration, ver vers
|
||||
},
|
||||
FolderConfiguration: cfg,
|
||||
|
||||
mtimeFS: mtimeFS,
|
||||
dir: cfg.Path(),
|
||||
fs: fs,
|
||||
versioner: ver,
|
||||
|
||||
queue: newJobQueue(),
|
||||
@@ -434,7 +431,7 @@ func (f *sendReceiveFolder) pullerIteration(ignores *ignore.Matcher) int {
|
||||
for _, fi := range processDirectly {
|
||||
// Verify that the thing we are handling lives inside a directory,
|
||||
// and not a symlink or empty space.
|
||||
if err := osutil.TraversesSymlink(f.dir, filepath.Dir(fi.Name)); err != nil {
|
||||
if err := osutil.TraversesSymlink(f.fs, filepath.Dir(fi.Name)); err != nil {
|
||||
f.newError(fi.Name, err)
|
||||
continue
|
||||
}
|
||||
@@ -523,7 +520,7 @@ nextFile:
|
||||
|
||||
// Verify that the thing we are handling lives inside a directory,
|
||||
// and not a symlink or empty space.
|
||||
if err := osutil.TraversesSymlink(f.dir, filepath.Dir(fi.Name)); err != nil {
|
||||
if err := osutil.TraversesSymlink(f.fs, filepath.Dir(fi.Name)); err != nil {
|
||||
f.newError(fi.Name, err)
|
||||
continue
|
||||
}
|
||||
@@ -610,12 +607,7 @@ func (f *sendReceiveFolder) handleDir(file protocol.FileInfo) {
|
||||
})
|
||||
}()
|
||||
|
||||
realName, err := rootedJoinedPath(f.dir, file.Name)
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return
|
||||
}
|
||||
mode := os.FileMode(file.Permissions & 0777)
|
||||
mode := fs.FileMode(file.Permissions & 0777)
|
||||
if f.ignorePermissions(file) {
|
||||
mode = 0777
|
||||
}
|
||||
@@ -625,13 +617,13 @@ func (f *sendReceiveFolder) handleDir(file protocol.FileInfo) {
|
||||
l.Debugf("need dir\n\t%v\n\t%v", file, curFile)
|
||||
}
|
||||
|
||||
info, err := f.mtimeFS.Lstat(realName)
|
||||
info, err := f.fs.Lstat(file.Name)
|
||||
switch {
|
||||
// There is already something under that name, but it's a file/link.
|
||||
// Most likely a file/link is getting replaced with a directory.
|
||||
// Remove the file/link and fall through to directory creation.
|
||||
case err == nil && (!info.IsDir() || info.IsSymlink()):
|
||||
err = osutil.InWritableDir(os.Remove, realName)
|
||||
err = osutil.InWritableDir(f.fs.Remove, f.fs, file.Name)
|
||||
if err != nil {
|
||||
l.Infof("Puller (folder %q, dir %q): %v", f.folderID, file.Name, err)
|
||||
f.newError(file.Name, err)
|
||||
@@ -640,28 +632,28 @@ func (f *sendReceiveFolder) handleDir(file protocol.FileInfo) {
|
||||
fallthrough
|
||||
// The directory doesn't exist, so we create it with the right
|
||||
// mode bits from the start.
|
||||
case err != nil && os.IsNotExist(err):
|
||||
case err != nil && fs.IsNotExist(err):
|
||||
// We declare a function that acts on only the path name, so
|
||||
// we can pass it to InWritableDir. We use a regular Mkdir and
|
||||
// not MkdirAll because the parent should already exist.
|
||||
mkdir := func(path string) error {
|
||||
err = os.Mkdir(path, mode)
|
||||
err = f.fs.Mkdir(path, mode)
|
||||
if err != nil || f.ignorePermissions(file) {
|
||||
return err
|
||||
}
|
||||
|
||||
// Stat the directory so we can check its permissions.
|
||||
info, err := f.mtimeFS.Lstat(path)
|
||||
info, err := f.fs.Lstat(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Mask for the bits we want to preserve and add them in to the
|
||||
// directories permissions.
|
||||
return os.Chmod(path, mode|(os.FileMode(info.Mode())&retainBits))
|
||||
return f.fs.Chmod(path, mode|(info.Mode()&retainBits))
|
||||
}
|
||||
|
||||
if err = osutil.InWritableDir(mkdir, realName); err == nil {
|
||||
if err = osutil.InWritableDir(mkdir, f.fs, file.Name); err == nil {
|
||||
f.dbUpdates <- dbUpdateJob{file, dbUpdateHandleDir}
|
||||
} else {
|
||||
l.Infof("Puller (folder %q, dir %q): %v", f.folderID, file.Name, err)
|
||||
@@ -681,7 +673,7 @@ func (f *sendReceiveFolder) handleDir(file protocol.FileInfo) {
|
||||
// It's OK to change mode bits on stuff within non-writable directories.
|
||||
if f.ignorePermissions(file) {
|
||||
f.dbUpdates <- dbUpdateJob{file, dbUpdateHandleDir}
|
||||
} else if err := os.Chmod(realName, mode|(os.FileMode(info.Mode())&retainBits)); err == nil {
|
||||
} else if err := f.fs.Chmod(file.Name, mode|(fs.FileMode(info.Mode())&retainBits)); err == nil {
|
||||
f.dbUpdates <- dbUpdateJob{file, dbUpdateHandleDir}
|
||||
} else {
|
||||
l.Infof("Puller (folder %q, dir %q): %v", f.folderID, file.Name, err)
|
||||
@@ -712,12 +704,6 @@ func (f *sendReceiveFolder) handleSymlink(file protocol.FileInfo) {
|
||||
})
|
||||
}()
|
||||
|
||||
realName, err := rootedJoinedPath(f.dir, file.Name)
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
if shouldDebug() {
|
||||
curFile, _ := f.model.CurrentFolderFile(f.folderID, file.Name)
|
||||
l.Debugf("need symlink\n\t%v\n\t%v", file, curFile)
|
||||
@@ -732,11 +718,11 @@ func (f *sendReceiveFolder) handleSymlink(file protocol.FileInfo) {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = f.mtimeFS.Lstat(realName); err == nil {
|
||||
if _, err = f.fs.Lstat(file.Name); err == nil {
|
||||
// There is already something under that name. Remove it to replace
|
||||
// with the symlink. This also handles the "change symlink type"
|
||||
// path.
|
||||
err = osutil.InWritableDir(os.Remove, realName)
|
||||
err = osutil.InWritableDir(f.fs.Remove, f.fs, file.Name)
|
||||
if err != nil {
|
||||
l.Infof("Puller (folder %q, dir %q): %v", f.folderID, file.Name, err)
|
||||
f.newError(file.Name, err)
|
||||
@@ -747,10 +733,10 @@ func (f *sendReceiveFolder) handleSymlink(file protocol.FileInfo) {
|
||||
// We declare a function that acts on only the path name, so
|
||||
// we can pass it to InWritableDir.
|
||||
createLink := func(path string) error {
|
||||
return os.Symlink(file.SymlinkTarget, path)
|
||||
return f.fs.CreateSymlink(file.SymlinkTarget, path)
|
||||
}
|
||||
|
||||
if err = osutil.InWritableDir(createLink, realName); err == nil {
|
||||
if err = osutil.InWritableDir(createLink, f.fs, file.Name); err == nil {
|
||||
f.dbUpdates <- dbUpdateJob{file, dbUpdateHandleSymlink}
|
||||
} else {
|
||||
l.Infof("Puller (folder %q, dir %q): %v", f.folderID, file.Name, err)
|
||||
@@ -781,31 +767,21 @@ func (f *sendReceiveFolder) deleteDir(file protocol.FileInfo, matcher *ignore.Ma
|
||||
})
|
||||
}()
|
||||
|
||||
realName, err := rootedJoinedPath(f.dir, file.Name)
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete any temporary files lying around in the directory
|
||||
dir, _ := os.Open(realName)
|
||||
if dir != nil {
|
||||
files, _ := dir.Readdirnames(-1)
|
||||
for _, dirFile := range files {
|
||||
fullDirFile := filepath.Join(file.Name, dirFile)
|
||||
if ignore.IsTemporary(dirFile) || (matcher != nil &&
|
||||
matcher.Match(fullDirFile).IsDeletable()) {
|
||||
os.RemoveAll(filepath.Join(f.dir, fullDirFile))
|
||||
}
|
||||
|
||||
files, _ := f.fs.DirNames(file.Name)
|
||||
for _, dirFile := range files {
|
||||
fullDirFile := filepath.Join(file.Name, dirFile)
|
||||
if ignore.IsTemporary(dirFile) || (matcher != nil && matcher.Match(fullDirFile).IsDeletable()) {
|
||||
f.fs.RemoveAll(fullDirFile)
|
||||
}
|
||||
dir.Close()
|
||||
}
|
||||
|
||||
err = osutil.InWritableDir(os.Remove, realName)
|
||||
if err == nil || os.IsNotExist(err) {
|
||||
err = osutil.InWritableDir(f.fs.Remove, f.fs, file.Name)
|
||||
if err == nil || fs.IsNotExist(err) {
|
||||
// It was removed or it doesn't exist to start with
|
||||
f.dbUpdates <- dbUpdateJob{file, dbUpdateDeleteDir}
|
||||
} else if _, serr := f.mtimeFS.Lstat(realName); serr != nil && !os.IsPermission(serr) {
|
||||
} else if _, serr := f.fs.Lstat(file.Name); serr != nil && !fs.IsPermission(serr) {
|
||||
// We get an error just looking at the directory, and it's not a
|
||||
// permission problem. Lets assume the error is in fact some variant
|
||||
// of "file does not exist" (possibly expressed as some parent being a
|
||||
@@ -840,12 +816,6 @@ func (f *sendReceiveFolder) deleteFile(file protocol.FileInfo) {
|
||||
})
|
||||
}()
|
||||
|
||||
realName, err := rootedJoinedPath(f.dir, file.Name)
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
cur, ok := f.model.CurrentFolderFile(f.folderID, file.Name)
|
||||
if ok && f.inConflict(cur.Version, file.Version) {
|
||||
// There is a conflict here. Move the file to a conflict copy instead
|
||||
@@ -854,17 +824,17 @@ func (f *sendReceiveFolder) deleteFile(file protocol.FileInfo) {
|
||||
file.Version = file.Version.Merge(cur.Version)
|
||||
err = osutil.InWritableDir(func(name string) error {
|
||||
return f.moveForConflict(name, file.ModifiedBy.String())
|
||||
}, realName)
|
||||
} else if f.versioner != nil {
|
||||
err = osutil.InWritableDir(f.versioner.Archive, realName)
|
||||
}, f.fs, file.Name)
|
||||
} else if f.versioner != nil && !cur.IsSymlink() {
|
||||
err = osutil.InWritableDir(f.versioner.Archive, f.fs, file.Name)
|
||||
} else {
|
||||
err = osutil.InWritableDir(os.Remove, realName)
|
||||
err = osutil.InWritableDir(f.fs.Remove, f.fs, file.Name)
|
||||
}
|
||||
|
||||
if err == nil || os.IsNotExist(err) {
|
||||
if err == nil || fs.IsNotExist(err) {
|
||||
// It was removed or it doesn't exist to start with
|
||||
f.dbUpdates <- dbUpdateJob{file, dbUpdateDeleteFile}
|
||||
} else if _, serr := f.mtimeFS.Lstat(realName); serr != nil && !os.IsPermission(serr) {
|
||||
} else if _, serr := f.fs.Lstat(file.Name); serr != nil && !fs.IsPermission(serr) {
|
||||
// We get an error just looking at the file, and it's not a permission
|
||||
// problem. Lets assume the error is in fact some variant of "file
|
||||
// does not exist" (possibly expressed as some parent being a file and
|
||||
@@ -915,24 +885,13 @@ func (f *sendReceiveFolder) renameFile(source, target protocol.FileInfo) {
|
||||
|
||||
l.Debugln(f, "taking rename shortcut", source.Name, "->", target.Name)
|
||||
|
||||
from, err := rootedJoinedPath(f.dir, source.Name)
|
||||
if err != nil {
|
||||
f.newError(source.Name, err)
|
||||
return
|
||||
}
|
||||
to, err := rootedJoinedPath(f.dir, target.Name)
|
||||
if err != nil {
|
||||
f.newError(target.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
if f.versioner != nil {
|
||||
err = osutil.Copy(from, to)
|
||||
err = osutil.Copy(f.fs, source.Name, target.Name)
|
||||
if err == nil {
|
||||
err = osutil.InWritableDir(f.versioner.Archive, from)
|
||||
err = osutil.InWritableDir(f.versioner.Archive, f.fs, source.Name)
|
||||
}
|
||||
} else {
|
||||
err = osutil.TryRename(from, to)
|
||||
err = osutil.TryRename(f.fs, source.Name, target.Name)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
@@ -955,7 +914,7 @@ func (f *sendReceiveFolder) renameFile(source, target protocol.FileInfo) {
|
||||
// get rid of. Attempt to delete it instead so that we make *some*
|
||||
// progress. The target is unhandled.
|
||||
|
||||
err = osutil.InWritableDir(os.Remove, from)
|
||||
err = osutil.InWritableDir(f.fs.Remove, f.fs, source.Name)
|
||||
if err != nil {
|
||||
l.Infof("Puller (folder %q, file %q): delete %q after failed rename: %v", f.folderID, target.Name, source.Name, err)
|
||||
f.newError(target.Name, err)
|
||||
@@ -1041,38 +1000,7 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
return
|
||||
}
|
||||
|
||||
// Figure out the absolute filenames we need once and for all
|
||||
tempName, err := rootedJoinedPath(f.dir, ignore.TempName(file.Name))
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return
|
||||
}
|
||||
realName, err := rootedJoinedPath(f.dir, file.Name)
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return
|
||||
}
|
||||
|
||||
if hasCurFile && !curFile.IsDirectory() && !curFile.IsSymlink() {
|
||||
// Check that the file on disk is what we expect it to be according to
|
||||
// the database. If there's a mismatch here, there might be local
|
||||
// changes that we don't know about yet and we should scan before
|
||||
// touching the file. If we can't stat the file we'll just pull it.
|
||||
if info, err := f.mtimeFS.Lstat(realName); err == nil {
|
||||
if !info.ModTime().Equal(curFile.ModTime()) || info.Size() != curFile.Size {
|
||||
l.Debugln("file modified but not rescanned; not pulling:", realName)
|
||||
// Scan() is synchronous (i.e. blocks until the scan is
|
||||
// completed and returns an error), but a scan can't happen
|
||||
// while we're in the puller routine. Request the scan in the
|
||||
// background and it'll be handled when the current pulling
|
||||
// sweep is complete. As we do retries, we'll queue the scan
|
||||
// for this file up to ten times, but the last nine of those
|
||||
// scans will be cheap...
|
||||
go f.Scan([]string{file.Name})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
tempName := ignore.TempName(file.Name)
|
||||
|
||||
scanner.PopulateOffsets(file.Blocks)
|
||||
|
||||
@@ -1082,7 +1010,7 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
|
||||
// Check for an old temporary file which might have some blocks we could
|
||||
// reuse.
|
||||
tempBlocks, err := scanner.HashFile(f.ctx, fs.DefaultFilesystem, tempName, protocol.BlockSize, nil, false)
|
||||
tempBlocks, err := scanner.HashFile(f.ctx, f.fs, tempName, protocol.BlockSize, nil, false)
|
||||
if err == nil {
|
||||
// Check for any reusable blocks in the temp file
|
||||
tempCopyBlocks, _ := scanner.BlockDiff(tempBlocks, file.Blocks)
|
||||
@@ -1110,7 +1038,7 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
// Otherwise, discard the file ourselves in order for the
|
||||
// sharedpuller not to panic when it fails to exclusively create a
|
||||
// file which already exists
|
||||
osutil.InWritableDir(os.Remove, tempName)
|
||||
osutil.InWritableDir(f.fs.Remove, f.fs, tempName)
|
||||
}
|
||||
} else {
|
||||
// Copy the blocks, as we don't want to shuffle them on the FileInfo
|
||||
@@ -1119,8 +1047,8 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
}
|
||||
|
||||
if f.MinDiskFree.BaseValue() > 0 {
|
||||
if free, err := osutil.DiskFreeBytes(f.dir); err == nil && free < blocksSize {
|
||||
l.Warnf(`Folder "%s": insufficient disk space in %s for %s: have %.2f MiB, need %.2f MiB`, f.folderID, f.dir, file.Name, float64(free)/1024/1024, float64(blocksSize)/1024/1024)
|
||||
if usage, err := f.fs.Usage("."); err == nil && usage.Free < blocksSize {
|
||||
l.Warnf(`Folder "%s": insufficient disk space in %s for %s: have %.2f MiB, need %.2f MiB`, f.folderID, f.fs.URI(), file.Name, float64(usage.Free)/1024/1024, float64(blocksSize)/1024/1024)
|
||||
f.newError(file.Name, errors.New("insufficient space"))
|
||||
return
|
||||
}
|
||||
@@ -1141,9 +1069,10 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
|
||||
s := sharedPullerState{
|
||||
file: file,
|
||||
fs: f.fs,
|
||||
folder: f.folderID,
|
||||
tempName: tempName,
|
||||
realName: realName,
|
||||
realName: file.Name,
|
||||
copyTotal: len(blocks),
|
||||
copyNeeded: len(blocks),
|
||||
reused: len(reused),
|
||||
@@ -1151,7 +1080,8 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
available: reused,
|
||||
availableUpdated: time.Now(),
|
||||
ignorePerms: f.ignorePermissions(file),
|
||||
version: curFile.Version,
|
||||
hasCurFile: hasCurFile,
|
||||
curFile: curFile,
|
||||
mut: sync.NewRWMutex(),
|
||||
sparse: !f.DisableSparseFiles,
|
||||
created: time.Now(),
|
||||
@@ -1170,20 +1100,15 @@ func (f *sendReceiveFolder) handleFile(file protocol.FileInfo, copyChan chan<- c
|
||||
// shortcutFile sets file mode and modification time, when that's the only
|
||||
// thing that has changed.
|
||||
func (f *sendReceiveFolder) shortcutFile(file protocol.FileInfo) error {
|
||||
realName, err := rootedJoinedPath(f.dir, file.Name)
|
||||
if err != nil {
|
||||
f.newError(file.Name, err)
|
||||
return err
|
||||
}
|
||||
if !f.ignorePermissions(file) {
|
||||
if err := os.Chmod(realName, os.FileMode(file.Permissions&0777)); err != nil {
|
||||
if err := f.fs.Chmod(file.Name, fs.FileMode(file.Permissions&0777)); err != nil {
|
||||
l.Infof("Puller (folder %q, file %q): shortcut: chmod: %v", f.folderID, file.Name, err)
|
||||
f.newError(file.Name, err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
f.mtimeFS.Chtimes(realName, file.ModTime(), file.ModTime()) // never fails
|
||||
f.fs.Chtimes(file.Name, file.ModTime(), file.ModTime()) // never fails
|
||||
|
||||
// This may have been a conflict. We should merge the version vectors so
|
||||
// that our clock doesn't move backwards.
|
||||
@@ -1211,15 +1136,16 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
f.model.progressEmitter.Register(state.sharedPullerState)
|
||||
}
|
||||
|
||||
folderRoots := make(map[string]string)
|
||||
folderFilesystems := make(map[string]fs.Filesystem)
|
||||
var folders []string
|
||||
f.model.fmut.RLock()
|
||||
for folder, cfg := range f.model.folderCfgs {
|
||||
folderRoots[folder] = cfg.Path()
|
||||
folderFilesystems[folder] = cfg.Filesystem()
|
||||
folders = append(folders, folder)
|
||||
}
|
||||
f.model.fmut.RUnlock()
|
||||
|
||||
var file fs.File
|
||||
var weakHashFinder *weakhash.Finder
|
||||
|
||||
if weakhash.Enabled {
|
||||
@@ -1237,9 +1163,12 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
}
|
||||
|
||||
if len(hashesToFind) > 0 {
|
||||
weakHashFinder, err = weakhash.NewFinder(state.realName, protocol.BlockSize, hashesToFind)
|
||||
if err != nil {
|
||||
l.Debugln("weak hasher", err)
|
||||
file, err = f.fs.Open(state.file.Name)
|
||||
if err == nil {
|
||||
weakHashFinder, err = weakhash.NewFinder(file, protocol.BlockSize, hashesToFind)
|
||||
if err != nil {
|
||||
l.Debugln("weak hasher", err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
l.Debugf("not weak hashing %s. file did not contain any weak hashes", state.file.Name)
|
||||
@@ -1289,12 +1218,9 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
}
|
||||
|
||||
if !found {
|
||||
found = f.model.finder.Iterate(folders, block.Hash, func(folder, file string, index int32) bool {
|
||||
inFile, err := rootedJoinedPath(folderRoots[folder], file)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
fd, err := os.Open(inFile)
|
||||
found = f.model.finder.Iterate(folders, block.Hash, func(folder, path string, index int32) bool {
|
||||
fs := folderFilesystems[folder]
|
||||
fd, err := fs.Open(path)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
@@ -1308,8 +1234,8 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
hash, err := scanner.VerifyBuffer(buf, block)
|
||||
if err != nil {
|
||||
if hash != nil {
|
||||
l.Debugf("Finder block mismatch in %s:%s:%d expected %q got %q", folder, file, index, block.Hash, hash)
|
||||
err = f.model.finder.Fix(folder, file, index, block.Hash, hash)
|
||||
l.Debugf("Finder block mismatch in %s:%s:%d expected %q got %q", folder, path, index, block.Hash, hash)
|
||||
err = f.model.finder.Fix(folder, path, index, block.Hash, hash)
|
||||
if err != nil {
|
||||
l.Warnln("finder fix:", err)
|
||||
}
|
||||
@@ -1323,7 +1249,7 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
if err != nil {
|
||||
state.fail("dst write", err)
|
||||
}
|
||||
if file == state.file.Name {
|
||||
if path == state.file.Name {
|
||||
state.copiedFromOrigin()
|
||||
}
|
||||
return true
|
||||
@@ -1345,7 +1271,12 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
state.copyDone(block)
|
||||
}
|
||||
}
|
||||
weakHashFinder.Close()
|
||||
if file != nil {
|
||||
// os.File used to return invalid argument if nil.
|
||||
// fs.File panics as it's an interface.
|
||||
file.Close()
|
||||
}
|
||||
|
||||
out <- state.sharedPullerState
|
||||
}
|
||||
}
|
||||
@@ -1426,15 +1357,45 @@ func (f *sendReceiveFolder) pullerRoutine(in <-chan pullBlockState, out chan<- *
|
||||
func (f *sendReceiveFolder) performFinish(state *sharedPullerState) error {
|
||||
// Set the correct permission bits on the new file
|
||||
if !f.ignorePermissions(state.file) {
|
||||
if err := os.Chmod(state.tempName, os.FileMode(state.file.Permissions&0777)); err != nil {
|
||||
if err := f.fs.Chmod(state.tempName, fs.FileMode(state.file.Permissions&0777)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if stat, err := f.mtimeFS.Lstat(state.realName); err == nil {
|
||||
if stat, err := f.fs.Lstat(state.file.Name); err == nil {
|
||||
// There is an old file or directory already in place. We need to
|
||||
// handle that.
|
||||
|
||||
curMode := uint32(stat.Mode())
|
||||
if runtime.GOOS == "windows" && osutil.IsWindowsExecutable(state.file.Name) {
|
||||
curMode |= 0111
|
||||
}
|
||||
|
||||
// Check that the file on disk is what we expect it to be according to
|
||||
// the database. If there's a mismatch here, there might be local
|
||||
// changes that we don't know about yet and we should scan before
|
||||
// touching the file.
|
||||
// There is also a case where we think the file should be there, but
|
||||
// it was removed, which is a conflict, yet creations always wins when
|
||||
// competing with a deletion, so no need to handle that specially.
|
||||
switch {
|
||||
// The file reappeared from nowhere, or mtime/size has changed, fallthrough -> rescan.
|
||||
case !state.hasCurFile || !stat.ModTime().Equal(state.curFile.ModTime()) || stat.Size() != state.curFile.Size:
|
||||
fallthrough
|
||||
// Permissions have changed, means the file has changed, rescan.
|
||||
case !f.ignorePermissions(state.curFile) && state.curFile.HasPermissionBits() && !scanner.PermsEqual(state.curFile.Permissions, curMode):
|
||||
l.Debugln("file modified but not rescanned; not finishing:", state.curFile.Name)
|
||||
// Scan() is synchronous (i.e. blocks until the scan is
|
||||
// completed and returns an error), but a scan can't happen
|
||||
// while we're in the puller routine. Request the scan in the
|
||||
// background and it'll be handled when the current pulling
|
||||
// sweep is complete. As we do retries, we'll queue the scan
|
||||
// for this file up to ten times, but the last nine of those
|
||||
// scans will be cheap...
|
||||
go f.Scan([]string{state.curFile.Name})
|
||||
return nil
|
||||
}
|
||||
|
||||
switch {
|
||||
case stat.IsDir() || stat.IsSymlink():
|
||||
// It's a directory or a symlink. These are not versioned or
|
||||
@@ -1445,30 +1406,30 @@ func (f *sendReceiveFolder) performFinish(state *sharedPullerState) error {
|
||||
// and future hard ignores before attempting a directory delete.
|
||||
// Should share code with f.deletDir().
|
||||
|
||||
if err = osutil.InWritableDir(os.Remove, state.realName); err != nil {
|
||||
if err = osutil.InWritableDir(f.fs.Remove, f.fs, state.file.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case f.inConflict(state.version, state.file.Version):
|
||||
case f.inConflict(state.curFile.Version, state.file.Version):
|
||||
// The new file has been changed in conflict with the existing one. We
|
||||
// should file it away as a conflict instead of just removing or
|
||||
// archiving. Also merge with the version vector we had, to indicate
|
||||
// we have resolved the conflict.
|
||||
|
||||
state.file.Version = state.file.Version.Merge(state.version)
|
||||
state.file.Version = state.file.Version.Merge(state.curFile.Version)
|
||||
err = osutil.InWritableDir(func(name string) error {
|
||||
return f.moveForConflict(name, state.file.ModifiedBy.String())
|
||||
}, state.realName)
|
||||
}, f.fs, state.file.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case f.versioner != nil:
|
||||
case f.versioner != nil && !state.file.IsSymlink():
|
||||
// If we should use versioning, let the versioner archive the old
|
||||
// file before we replace it. Archiving a non-existent file is not
|
||||
// an error.
|
||||
|
||||
if err = f.versioner.Archive(state.realName); err != nil {
|
||||
if err = f.versioner.Archive(state.file.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -1476,12 +1437,12 @@ func (f *sendReceiveFolder) performFinish(state *sharedPullerState) error {
|
||||
|
||||
// Replace the original content with the new one. If it didn't work,
|
||||
// leave the temp file in place for reuse.
|
||||
if err := osutil.TryRename(state.tempName, state.realName); err != nil {
|
||||
if err := osutil.TryRename(f.fs, state.tempName, state.file.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set the correct timestamp on the new file
|
||||
f.mtimeFS.Chtimes(state.realName, state.file.ModTime(), state.file.ModTime()) // never fails
|
||||
f.fs.Chtimes(state.file.Name, state.file.ModTime(), state.file.ModTime()) // never fails
|
||||
|
||||
// Record the updated file in the index
|
||||
f.dbUpdates <- dbUpdateJob{state.file, dbUpdateHandleFile}
|
||||
@@ -1540,26 +1501,7 @@ func (f *sendReceiveFolder) dbUpdaterRoutine() {
|
||||
tick := time.NewTicker(maxBatchTime)
|
||||
defer tick.Stop()
|
||||
|
||||
var changedFiles []string
|
||||
var changedDirs []string
|
||||
if f.Fsync {
|
||||
changedFiles = make([]string, 0, maxBatchSize)
|
||||
changedDirs = make([]string, 0, maxBatchSize)
|
||||
}
|
||||
|
||||
syncFilesOnce := func(files []string, syncFn func(string) error) {
|
||||
sort.Strings(files)
|
||||
var lastFile string
|
||||
for _, file := range files {
|
||||
if lastFile == file {
|
||||
continue
|
||||
}
|
||||
lastFile = file
|
||||
if err := syncFn(file); err != nil {
|
||||
l.Infof("fsync %q failed: %v", file, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
changedDirs := make(map[string]struct{})
|
||||
|
||||
handleBatch := func() {
|
||||
found := false
|
||||
@@ -1567,20 +1509,16 @@ func (f *sendReceiveFolder) dbUpdaterRoutine() {
|
||||
|
||||
for _, job := range batch {
|
||||
files = append(files, job.file)
|
||||
if f.Fsync {
|
||||
// collect changed files and dirs
|
||||
switch job.jobType {
|
||||
case dbUpdateHandleFile, dbUpdateShortcutFile:
|
||||
changedFiles = append(changedFiles, filepath.Join(f.dir, job.file.Name))
|
||||
case dbUpdateHandleDir:
|
||||
changedDirs = append(changedDirs, filepath.Join(f.dir, job.file.Name))
|
||||
case dbUpdateHandleSymlink:
|
||||
// fsyncing symlinks is only supported by MacOS, ignore
|
||||
}
|
||||
if job.jobType != dbUpdateShortcutFile {
|
||||
changedDirs = append(changedDirs, filepath.Dir(filepath.Join(f.dir, job.file.Name)))
|
||||
}
|
||||
|
||||
switch job.jobType {
|
||||
case dbUpdateHandleFile, dbUpdateShortcutFile:
|
||||
changedDirs[filepath.Dir(job.file.Name)] = struct{}{}
|
||||
case dbUpdateHandleDir:
|
||||
changedDirs[job.file.Name] = struct{}{}
|
||||
case dbUpdateHandleSymlink:
|
||||
// fsyncing symlinks is only supported by MacOS, ignore
|
||||
}
|
||||
|
||||
if job.file.IsInvalid() || (job.file.IsDirectory() && !job.file.IsSymlink()) {
|
||||
continue
|
||||
}
|
||||
@@ -1593,12 +1531,18 @@ func (f *sendReceiveFolder) dbUpdaterRoutine() {
|
||||
lastFile = job.file
|
||||
}
|
||||
|
||||
if f.Fsync {
|
||||
// sync files and dirs to disk
|
||||
syncFilesOnce(changedFiles, osutil.SyncFile)
|
||||
changedFiles = changedFiles[:0]
|
||||
syncFilesOnce(changedDirs, osutil.SyncDir)
|
||||
changedDirs = changedDirs[:0]
|
||||
// sync directories
|
||||
for dir := range changedDirs {
|
||||
delete(changedDirs, dir)
|
||||
fd, err := f.fs.Open(dir)
|
||||
if err != nil {
|
||||
l.Infof("fsync %q failed: %v", dir, err)
|
||||
continue
|
||||
}
|
||||
if err := fd.Sync(); err != nil {
|
||||
l.Infof("fsync %q failed: %v", dir, err)
|
||||
}
|
||||
fd.Close()
|
||||
}
|
||||
|
||||
// All updates to file/folder objects that originated remotely
|
||||
@@ -1669,14 +1613,14 @@ func removeAvailability(availabilities []Availability, availability Availability
|
||||
func (f *sendReceiveFolder) moveForConflict(name string, lastModBy string) error {
|
||||
if strings.Contains(filepath.Base(name), ".sync-conflict-") {
|
||||
l.Infoln("Conflict for", name, "which is already a conflict copy; not copying again.")
|
||||
if err := os.Remove(name); err != nil && !os.IsNotExist(err) {
|
||||
if err := f.fs.Remove(name); err != nil && !fs.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if f.MaxConflicts == 0 {
|
||||
if err := os.Remove(name); err != nil && !os.IsNotExist(err) {
|
||||
if err := f.fs.Remove(name); err != nil && !fs.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -1685,8 +1629,8 @@ func (f *sendReceiveFolder) moveForConflict(name string, lastModBy string) error
|
||||
ext := filepath.Ext(name)
|
||||
withoutExt := name[:len(name)-len(ext)]
|
||||
newName := withoutExt + time.Now().Format(".sync-conflict-20060102-150405-") + lastModBy + ext
|
||||
err := os.Rename(name, newName)
|
||||
if os.IsNotExist(err) {
|
||||
err := f.fs.Rename(name, newName)
|
||||
if fs.IsNotExist(err) {
|
||||
// We were supposed to move a file away but it does not exist. Either
|
||||
// the user has already moved it away, or the conflict was between a
|
||||
// remote modification and a local delete. In either way it does not
|
||||
@@ -1694,11 +1638,11 @@ func (f *sendReceiveFolder) moveForConflict(name string, lastModBy string) error
|
||||
err = nil
|
||||
}
|
||||
if f.MaxConflicts > -1 {
|
||||
matches, gerr := osutil.Glob(withoutExt + ".sync-conflict-????????-??????*" + ext)
|
||||
matches, gerr := f.fs.Glob(withoutExt + ".sync-conflict-????????-??????*" + ext)
|
||||
if gerr == nil && len(matches) > f.MaxConflicts {
|
||||
sort.Sort(sort.Reverse(sort.StringSlice(matches)))
|
||||
for _, match := range matches[f.MaxConflicts:] {
|
||||
gerr = os.Remove(match)
|
||||
gerr = f.fs.Remove(match)
|
||||
if gerr != nil {
|
||||
l.Debugln(f, "removing extra conflict", gerr)
|
||||
}
|
||||
@@ -1772,7 +1716,7 @@ func fileValid(file db.FileIntf) error {
|
||||
return errSymlinksUnsupported
|
||||
|
||||
case runtime.GOOS == "windows" && windowsInvalidFilename(file.FileName()):
|
||||
return errInvalidFilename
|
||||
return fs.ErrInvalidFilename
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -1821,7 +1765,7 @@ func (l byComponentCount) Swap(a, b int) {
|
||||
func componentCount(name string) int {
|
||||
count := 0
|
||||
for _, codepoint := range name {
|
||||
if codepoint == os.PathSeparator {
|
||||
if codepoint == fs.PathSeparator {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,7 @@ func setUpSendReceiveFolder(model *Model) *sendReceiveFolder {
|
||||
ctx: context.TODO(),
|
||||
},
|
||||
|
||||
mtimeFS: fs.NewMtimeFS(fs.DefaultFilesystem, db.NewNamespacedKV(model.db, "mtime")),
|
||||
dir: "testdata",
|
||||
fs: fs.NewMtimeFS(fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata"), db.NewNamespacedKV(model.db, "mtime")),
|
||||
queue: newJobQueue(),
|
||||
errors: make(map[string]string),
|
||||
errorsMut: sync.NewMutex(),
|
||||
@@ -246,7 +245,7 @@ func TestCopierFinder(t *testing.T) {
|
||||
}
|
||||
|
||||
// Verify that the fetched blocks have actually been written to the temp file
|
||||
blks, err := scanner.HashFile(context.TODO(), fs.DefaultFilesystem, tempFile, protocol.BlockSize, nil, false)
|
||||
blks, err := scanner.HashFile(context.TODO(), fs.NewFilesystem(fs.FilesystemTypeBasic, "."), tempFile, protocol.BlockSize, nil, false)
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ package model
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/sync"
|
||||
)
|
||||
@@ -21,18 +21,20 @@ import (
|
||||
type sharedPullerState struct {
|
||||
// Immutable, does not require locking
|
||||
file protocol.FileInfo // The new file (desired end state)
|
||||
fs fs.Filesystem
|
||||
folder string
|
||||
tempName string
|
||||
realName string
|
||||
reused int // Number of blocks reused from temporary file
|
||||
ignorePerms bool
|
||||
version protocol.Vector // The current (old) version
|
||||
hasCurFile bool // Whether curFile is set
|
||||
curFile protocol.FileInfo // The file as it exists now in our database
|
||||
sparse bool
|
||||
created time.Time
|
||||
|
||||
// Mutable, must be locked for access
|
||||
err error // The first error we hit
|
||||
fd *os.File // The fd of the temp file
|
||||
fd fs.File // The fd of the temp file
|
||||
copyTotal int // Total number of copy actions for the whole job
|
||||
pullTotal int // Total number of pull actions for the whole job
|
||||
copyOrigin int // Number of blocks copied from the original file
|
||||
@@ -92,8 +94,8 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
// osutil.InWritableDir except we need to do more stuff so we duplicate it
|
||||
// here.
|
||||
dir := filepath.Dir(s.tempName)
|
||||
if info, err := os.Stat(dir); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if info, err := s.fs.Stat(dir); err != nil {
|
||||
if fs.IsNotExist(err) {
|
||||
// XXX: This works around a bug elsewhere, a race condition when
|
||||
// things are deleted while being synced. However that happens, we
|
||||
// end up with a directory for "foo" with the delete bit, but a
|
||||
@@ -103,7 +105,7 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
// next scan it'll be found and the delete bit on it is removed.
|
||||
// The user can then clean up as they like...
|
||||
l.Infoln("Resurrecting directory", dir)
|
||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||
if err := s.fs.MkdirAll(dir, 0755); err != nil {
|
||||
s.failLocked("resurrect dir", err)
|
||||
return nil, err
|
||||
}
|
||||
@@ -112,10 +114,10 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
return nil, err
|
||||
}
|
||||
} else if info.Mode()&0200 == 0 {
|
||||
err := os.Chmod(dir, 0755)
|
||||
err := s.fs.Chmod(dir, 0755)
|
||||
if !s.ignorePerms && err == nil {
|
||||
defer func() {
|
||||
err := os.Chmod(dir, info.Mode().Perm())
|
||||
err := s.fs.Chmod(dir, info.Mode()&fs.ModePerm)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -128,7 +130,7 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
// permissions will be set to the final value later, but in the meantime
|
||||
// we don't want to have a temporary file with looser permissions than
|
||||
// the final outcome.
|
||||
mode := os.FileMode(s.file.Permissions) | 0600
|
||||
mode := fs.FileMode(s.file.Permissions) | 0600
|
||||
if s.ignorePerms {
|
||||
// When ignorePerms is set we use a very permissive mode and let the
|
||||
// system umask filter it.
|
||||
@@ -137,9 +139,9 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
|
||||
// Attempt to create the temp file
|
||||
// RDWR because of issue #2994.
|
||||
flags := os.O_RDWR
|
||||
flags := fs.OptReadWrite
|
||||
if s.reused == 0 {
|
||||
flags |= os.O_CREATE | os.O_EXCL
|
||||
flags |= fs.OptCreate | fs.OptExclusive
|
||||
} else if !s.ignorePerms {
|
||||
// With sufficiently bad luck when exiting or crashing, we may have
|
||||
// had time to chmod the temp file to read only state but not yet
|
||||
@@ -151,12 +153,12 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
// already and make no modification, as we would otherwise override
|
||||
// what the umask dictates.
|
||||
|
||||
if err := os.Chmod(s.tempName, mode); err != nil {
|
||||
if err := s.fs.Chmod(s.tempName, mode); err != nil {
|
||||
s.failLocked("dst create chmod", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
fd, err := os.OpenFile(s.tempName, flags, mode)
|
||||
fd, err := s.fs.OpenFile(s.tempName, flags, mode)
|
||||
if err != nil {
|
||||
s.failLocked("dst create", err)
|
||||
return nil, err
|
||||
@@ -180,7 +182,7 @@ func (s *sharedPullerState) tempFile() (io.WriterAt, error) {
|
||||
}
|
||||
|
||||
// sourceFile opens the existing source file for reading
|
||||
func (s *sharedPullerState) sourceFile() (*os.File, error) {
|
||||
func (s *sharedPullerState) sourceFile() (fs.File, error) {
|
||||
s.mut.Lock()
|
||||
defer s.mut.Unlock()
|
||||
|
||||
@@ -190,7 +192,7 @@ func (s *sharedPullerState) sourceFile() (*os.File, error) {
|
||||
}
|
||||
|
||||
// Attempt to open the existing file
|
||||
fd, err := os.Open(s.realName)
|
||||
fd, err := s.fs.Open(s.realName)
|
||||
if err != nil {
|
||||
s.failLocked("src open", err)
|
||||
return nil, err
|
||||
@@ -292,9 +294,12 @@ func (s *sharedPullerState) finalClose() (bool, error) {
|
||||
}
|
||||
|
||||
if s.fd != nil {
|
||||
// This is our error if we weren't errored before. Otherwise we
|
||||
// keep the earlier error.
|
||||
if fsyncErr := s.fd.Sync(); fsyncErr != nil && s.err == nil {
|
||||
s.err = fsyncErr
|
||||
}
|
||||
if closeErr := s.fd.Close(); closeErr != nil && s.err == nil {
|
||||
// This is our error if we weren't errored before. Otherwise we
|
||||
// keep the earlier error.
|
||||
s.err = closeErr
|
||||
}
|
||||
s.fd = nil
|
||||
|
||||
@@ -10,12 +10,14 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/fs"
|
||||
"github.com/syncthing/syncthing/lib/sync"
|
||||
)
|
||||
|
||||
func TestSourceFileOK(t *testing.T) {
|
||||
s := sharedPullerState{
|
||||
realName: "testdata/foo",
|
||||
fs: fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata"),
|
||||
realName: "foo",
|
||||
mut: sync.NewRWMutex(),
|
||||
}
|
||||
|
||||
@@ -47,6 +49,7 @@ func TestSourceFileOK(t *testing.T) {
|
||||
|
||||
func TestSourceFileBad(t *testing.T) {
|
||||
s := sharedPullerState{
|
||||
fs: fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata"),
|
||||
realName: "nonexistent",
|
||||
mut: sync.NewRWMutex(),
|
||||
}
|
||||
@@ -73,7 +76,8 @@ func TestReadOnlyDir(t *testing.T) {
|
||||
}()
|
||||
|
||||
s := sharedPullerState{
|
||||
tempName: "testdata/read_only_dir/.temp_name",
|
||||
fs: fs.NewFilesystem(fs.FilesystemTypeBasic, "testdata"),
|
||||
tempName: "read_only_dir/.temp_name",
|
||||
mut: sync.NewRWMutex(),
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user