Commit Graph
100 Commits
Author SHA1 Message Date
Jakob BorgandAudrius Butkevicius 72d645865e lib/connections: Fix race condition in parallel dial, minor cleanups (fixes #4526)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4527
2017-11-19 17:38:13 +00:00
Jakob BorgandAudrius Butkevicius 5f4ed66aa1 lib/model: Properly schedule pull on reconnect (fixes #4504)
We need to reset prevSeq so that we force a full check when someone
reconnects - the sequence number may not have changed due to the
reconnect. (This is a regression; we did this before f6ea2a7.)

Also add an optimization: we schedule a pull after scanning, but there
is no need to do so if no changes were detected. This matters now
because the scheduled pull actually traverses the database which is
expensive.

This, however, makes the pull not happen on initial scan if there were
no changes during the initial scan. Compensate by always scheduling a
pull after initial scan in the rwfolder itself.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4508
LGTM: imsodin, AudriusButkevicius
2017-11-17 12:11:45 +00:00
Jakob BorgandAudrius Butkevicius ee5d0dd43f lib/fs: Add case insensitivity to MtimeFS
This is step one of a hundred fifty on the path to case insensitivity.
It brings in the basic case folding mechanism and adds it to the
mtimefs, as this is something outside the fileset that touches stuff in
the database based on name. No effort to convert or handle existing
entries when the insensitivity is changed, I don't think we need it...

Useless by itself but includes tests and will reduce the review load
along the way.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4521
2017-11-17 12:10:16 +00:00
Jakob BorgandAudrius Butkevicius 7ebf58f1bc Fix discovery in the absence of listen addresses (fixes #4418)
This makes it OK to not have any listeners working. Specifically,

- We don't complain about an empty listener address
- We don't complain about not having anything to announce to global
  discovery servers
- We don't send local discovery packets when there is nothing to
  announce.

The last point also fixes a thing where the list of addresses for local
discovery was set at startup time and never refreshed.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4517
2017-11-17 09:12:35 +00:00
Jakob Borg 783dd612f7 gui, man: Update docs & translations 2017-11-15 07:45:19 +01:00
Jakob Borg 2b65e1062e lib/model: Fix rescan detection (fixes #4505, fixes #4506)
Diff is large due to comment reformatting and indentation but all it
does is wrap the file mtime/size/permissions check in an "if
stat.IsRegular()".

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4507
2017-11-13 06:57:07 +00:00
Jakob Borg 80031c59da test: Clean & unflake cli & conflict tests 2017-11-13 01:06:16 +01:00
Jakob Borg 6e35592e9e test: Clean & unflake HTTP / filetype tests 2017-11-13 01:00:49 +01:00
Jakob Borg 9e11d7b201 test: Clean and unflake ignore / manupeers / reconnect / override tests 2017-11-13 01:00:36 +01:00
Jakob Borg fd5f9f8968 test: Fix reconnect test 2017-11-13 00:36:37 +01:00
Jakob Borg d8a0a477ca test: Unflake symlink/scan tests 2017-11-13 00:25:07 +01:00
Jakob Borg 6dd6ecde95 test: Clean up and unflake sync cluster test 2017-11-13 00:25:07 +01:00
Jakob Borg 6e148e20cd test: Mend tests for latest event changes etc 2017-11-13 00:25:07 +01:00
Jakob Borg 72c5f2e5c6 test: Updates for fs/osutil package changes 2017-11-13 00:25:07 +01:00
Jakob BorgandAudrius Butkevicius d7d45d8092 lib/db: Refactor away the large genericReplace thing
This removes a significant, complex chunk of database code. The
"replace" operation walked both the old and new in lockstep and made the
relevant changes to make the new situation correct. But since delta
indexes we pretty much never need this - we just used replace to drop
the existing data and start over.

This makes that explicit and removes the complexity.

(This is one of those things that would be annoying to make case
insensitive, while the actual "drop and then insert" that we do is
easier.)

This is fairly well unit tested...

The one change to the tests is to cover the fact that previously replace
with something identical didn't bump the sequence number, while
obviously removing everything and re-inserting does. This is not
behavior we depend on anywhere.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4500
LGTM: imsodin, AudriusButkevicius
2017-11-12 20:20:34 +00:00
Jakob Borg 57d5dfa80c jenkins: No jenkins 2017-11-11 23:49:37 +01:00
Jakob Borg a9d422e008 Revert "lib/model: Use the new file name when requesting rescan"
This has consequences that I haven't thought through for case mismatches
(i.e. we have foo.txt in the database and queue a rescan for FOO.txt).
2017-11-09 13:55:45 +01:00
Jakob Borg 75f64733f9 lib/model: Use the new file name when requesting rescan
If the file is not already in the database, the "curfile" will be empty
and the rescan request cover the entire folder.
2017-11-09 13:48:39 +01:00
Jakob Borg 40c952c0ae gui, man: Update docs & translations 2017-11-08 07:45:21 +01:00
Jakob Borg 941c9f1531 cmd/syncthing: Accept pre-hashed password in config POST (fixes #4458)
It must be a bcrypt hash.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4466
2017-11-06 14:22:10 +00:00
Jakob BorgandAudrius Butkevicius 9c855ab22e lib/config, lib/model: Configurable folder marker name (fixes #1126)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4483
2017-11-05 12:18:05 +00:00
Jakob Borg 166273b357 vendor: Patch github.com/ccding/go-stun for user-visible spelling error 2017-11-05 12:05:01 +01:00
Jakob Borg d304498027 vendor: Update github.com/syndtr/goleveldb, minor bugfixes 2017-11-05 10:56:24 +01:00
Jakob Borg 3f85f719de authors: Add nelsonkhan 2017-11-03 08:00:14 +01:00
Jakob Borg 7ba05c18ee Merge branch 'release'
* release:
  cmd/syncthing: Fix incorrect shadowing preventing first startup (fixes #4471)
2017-11-02 07:48:50 +01:00
Jakob Borg 617bf173a4 gui, man: Update docs & translations 2017-11-01 07:45:19 +01:00
Jakob Borg 5f8c0ca932 cmd/syncthing: Fix incorrect shadowing preventing first startup (fixes #4471) 2017-10-28 21:15:32 +02:00
Jakob Borg 93a66deb7e cmd/syncthing: Fix incorrect shadowing preventing first startup (fixes #4471) 2017-10-28 21:14:37 +02:00
Jakob Borg 997bed569e Merge branch 'release'
* release:
  lib/model: Add initial noop watch cancel func (fixes #4464)
  vendor: Fix kcp deadlock
2017-10-28 10:04:28 +02:00
Jakob Borg 9ecf9a3f48 gui, man: Update docs & translations 2017-10-25 07:45:19 +02:00
Jakob Borg d65f1fb08a lib/config: Improve debug logging around folder marker 2017-10-22 00:04:51 +02:00
Jakob Borg dfad6a2aa9 gui, man: Update docs & translations 2017-10-18 07:45:20 +02:00
Jakob BorgandAudrius Butkevicius 06da67e6fc issue_template: Clarify what to post and not post
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4416
2017-10-12 07:14:21 +00:00
Jakob BorgandAudrius Butkevicius 2f08f8021f lib/beacon: Don't exit after a single write failure (fixes #4414)
With VPNs and stuff we can get a single failure on an interface that
supposedly supports broadcasts without it being fatal.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4415
2017-10-12 07:13:44 +00:00
Jakob Borg 813e6ddf83 gui, man: Update docs & translations 2017-10-11 07:45:19 +02:00
Jakob Borg 0b5c11bf93 gui, man: Update docs & translations 2017-10-04 07:45:19 +02:00
Jakob Borg 9717c3d292 authors: Add tobiastom 2017-09-25 07:51:21 +02:00
Jakob BorgandAudrius Butkevicius a365ae51c4 lib/model: Hide temporary files on Windows while they are in use (fixes #4382)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4394
2017-09-23 13:47:51 +00:00
Jakob Borg 97222797a0 lib/config: Make folder marker change non fatal 2017-09-23 15:29:55 +02:00
Jakob Borg 2dd9450793 lib/protocol, vendor: Import luhn code directly
I've changed it incompatibly to fix a correctness bug. Nonetheless, we
should remain incorrect indefinitely.
2017-09-20 21:34:32 +02:00
Jakob BorgandAudrius Butkevicius 3ee12464b4 lib/config, lib/model: Make sure to hide our special files (fixes #4382)
The folder marker conversion forgot to hide the .stfolder. This adds
that, for those who have not yet been converted.

Also adds Hide() calls to the folder start, to mend historical
unhidedness. (I'm sure this will upset someone who is manually managing
their .stignores in the other direction...)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4384
2017-09-20 06:49:04 +00:00
Jakob Borg 59ebcea356 gui, man: Update docs & translations 2017-09-20 07:45:17 +02:00
Jakob Borg f40d219370 gui, man: Update docs & translations 2017-09-13 07:45:17 +02:00
Jakob BorgandAudrius Butkevicius 429cc20eb7 cmd/syncthing: Add some common security releated HTTP headers (fixes #4360)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4361
2017-09-10 08:28:12 +00:00
Jakob Borg 283c8d95e2 lib/protocol: Comment typo 2017-09-08 15:25:14 +02:00
Jakob BorgandAudrius Butkevicius 4d3e0de4ba cmd/syncthing, lib/sha256: Skip CPU benchmarks when user decided (fixes #4348)
When STHASHING is set, don't benchmark as it's already decided. If weak
hashing isn't set to "auto", don't benchmark that either.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4349
2017-09-06 06:55:47 +00:00
Jakob Borg baec3f909c gui, man: Update docs & translations 2017-09-06 07:45:19 +02:00
Jakob BorgandAudrius Butkevicius 9682bbfbda lib/protocol: Optimize luhn and chunk functions
These functions were very naive and slow. We haven't done much about
them because they pretty much don't matter at all for Syncthing
performance. They are however called very often in the discovery server
and these optimizations have a huge effect on the CPU load on the
public discovery servers.

The code isn't exactly obvious, but we have good test coverage on all
these functions.

benchmark                 old ns/op     new ns/op     delta
BenchmarkLuhnify-8        12458         1045          -91.61%
BenchmarkUnluhnify-8      12598         1074          -91.47%
BenchmarkChunkify-8       10792         104           -99.04%

benchmark                 old allocs     new allocs     delta
BenchmarkLuhnify-8        18             1              -94.44%
BenchmarkUnluhnify-8      18             1              -94.44%
BenchmarkChunkify-8       44             2              -95.45%

benchmark                 old bytes     new bytes     delta
BenchmarkLuhnify-8        1278          64            -94.99%
BenchmarkUnluhnify-8      1278          64            -94.99%
BenchmarkChunkify-8       42552         128           -99.70%

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4346
2017-09-03 10:26:12 +00:00
Jakob Borg 49bddfbe53 cmd/syncthing: Add test for truncate behavior of log file (ref #4255)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4342
2017-09-02 06:56:35 +00:00
Jakob Borg 19e52a10df readme: Update badges for new build server 2017-09-01 14:23:17 +02:00
Jakob Borg a8145e187f lib/model: Fixup because I suck and shouldn't commit directly to master 2017-08-31 10:49:17 +02:00
Jakob Borg e33fa10115 lib/model: Use same batch size constants in db updater as for protocol 2017-08-31 10:47:39 +02:00
Jakob BorgandAudrius Butkevicius 4b6e7e7867 lib/tlsutil: Remove undesired bufio from UnionedConnection (ref #4245)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4335
2017-08-31 07:34:48 +00:00
Jakob Borg 70d121a94b cmd/strelaysrv: Smaller, adjustable network buffer 2017-08-30 18:52:28 +02:00
Jakob Borg 33ffb07d31 cmd/strelaysrv: Don't leak tickers 2017-08-30 18:46:50 +02:00
Jakob Borg 7aaa92ac47 cmd/strelaysrv: Add profiling support, default disabled 2017-08-30 16:07:15 +02:00
Jakob Borg 5883eb9a25 gui, man: Update docs & translations 2017-08-30 10:50:19 +02:00
Jakob Borg b31611a8d1 gui, man: Update docs & translations
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4320
2017-08-22 09:00:52 +00:00
Jakob Borg 1fc2ab444b lib/model: Remove ineffective symlink recovery attempt 2017-08-08 15:30:28 +02:00
Jakob Borg fa5c890ff6 lib/versioner: Clean the versions dir of symlinks, not the full folder
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4289
2017-08-08 13:13:08 +00:00
Jakob Borg a3c17f8f81 lib/model: Disable symlink attack test on Windows 2017-08-08 08:05:24 +02:00
Jakob Borg f1f21bf220 lib/model, lib/versioner: Prevent symlink attack via versioning (fixes #4286)
Prior to this, the following is possible:

- Create a symlink "foo -> /somewhere", it gets synced
- Delete "foo", it gets versioned
- Create "foo/bar", it gets synced
- Delete "foo/bar", it gets versioned in "/somewhere/bar"

With this change, versioners should never version symlinks.
2017-08-07 07:57:10 +02:00
Jakob Borg 414c58174b build: Move -installsuffix behind an explicit option (fixes #4272) 2017-07-27 12:55:07 +02:00
Jakob Borg fa4226cae4 authors: Add rasa 2017-07-17 15:06:47 +02:00
Jakob Borg cc63236a2e build: Use Go's default GOPATH if it's valid
As of Go 1.8 it's valid to not have a GOPATH set. We ask the Go tool
what the GOPATH seems to be, and if we find ourselves (or a valid copy
of ourselves...) in that location we do not fiddle with the GOPATH.
2017-07-16 21:39:29 +01:00
Jakob Borg 6623657ef3 build: The default build step already includes linting 2017-07-15 17:06:22 +02:00
Jakob Borg e371800878 authors: Fixup jmdaweb 2017-07-14 07:53:18 +02:00
Jakob Borg 7a47646534 authors: Add jmdaweb 2017-07-14 07:49:08 +02:00
Jakob Borg d475ad7ce1 gui, man: Update docs & translations 2017-07-13 08:55:12 +02:00
Jakob BorgandSimon Frei 7c8418f493 build: Support builds outside of GOPATH
This adds support for building with the source placed anywhere and no
GOPATH set. The build script handles this by creating a temporary GOPATH
in the system temp dir (or another specified location) and mirroring the
source there before building. The resulting binaries etc still end up in
the same place as usual, meaning at least the "build", "install", "tar",
"zip", "deb", "snap", "test", "vet", "lint", "metalint" and "clean"
commands work without a GOPATH. To this end these commands internally
use fully qualified package paths like
"github.com/syncthing/syncthing/cmd/..." instead of "./cmd/..." like
before.

There is a new command "gopath" that prepares and echoes the directory
of the temporary GOPATH. This can be used to run other non-build go
commands:

export GOPATH=$(go run build.go gopath)  // GOPATH is now set
go test -v -race github.com/syncthing/syncthing/cmd/...

There is a new option "-no-build-gopath" that prevents the
check-and-copy step, instead assuming the temporary GOPATH is already
created and up to date. This is a performance optimization for build
servers running multiple builds commands in sequence:

go run build.go gopath // creates a temporary GOPATH
go run build.go -no-build-gopath -goos=... tar // reuses GOPATH
go run build.go -no-build-gopath -goos=... tar // reuses GOPATH

The temporary GOPATH is placed in the system temporary directory
(os.TempDir()) unless overridden by the STTMPDIR variable. It is named
after the hash of the current directory where build.go is run. The
reason for this is that the name should be unique to a source checkout
without risk for conflict, but still persistent between runs of
build.go.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4253
LGTM: AudriusButkevicius, imsodin
2017-07-11 07:57:58 +00:00
Jakob Borg 200a7fc844 meta: Move metadata checks into meta directory, make them tests
This moves a few things from script/ to a new directory meta/, and makes
them real Go tests. These are the authors, copyright, metalint and gofmt
checks. That means that they can now be run by

go test -v ./meta

and optionally filtered by the usual -run thing to go test. Also -short
will cut down on the metalint stuff and exclude the authors check (which
is slow because it runs git lots of times).

Mainly this makes everything easier on things like build servers where
we can now just run tests instead of do a bunch of scripting.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4252
2017-07-07 20:43:26 +00:00
Jakob Borg 5a38e0ba3f script: Trivial lint error in changelog.go 2017-07-07 21:56:12 +02:00
Jakob Borg c77490c32d authors: Fixup author email mistakes 2017-07-07 21:42:50 +02:00
Jakob Borg 487655b365 gui, man: Update docs & translations 2017-07-05 07:45:22 +02:00
Jakob Borg b79f8aceb8 authors: Fixup liusy182 2017-07-03 16:40:02 +02:00
Jakob Borg 92e8c4303a authors: Add liusy182 2017-07-03 16:33:41 +02:00
Jakob Borg e735a3a25c build: Builds from "release" branch are not branch builds 2017-06-30 14:02:16 +02:00
Jakob Borg 34f8cc8620 gui: Rename assets/lang/README-FIRST to README for greater visibility
README is rendered in the GitHub web UI
2017-06-28 18:58:41 +02:00
Jakob Borg add10c98fa lib/db: Fix test for Go 1.9's smarter time.Time values 2017-06-28 14:36:04 +02:00
Jakob Borg 6503326073 gui, man: Update docs & translations 2017-06-28 07:45:20 +02:00
Jakob BorgandAudrius Butkevicius db1dc9985a lib/upgrade: 0.x to 1.0 is a minor upgrade
This removes the special handling of minor versions as major when the
actual major is zero, and adds the special case that upgrades from 0.x
to 1.x are considered minor. 0.x to 2.x or 1.x to 2.x etc are still
considered major.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4226
2017-06-25 14:17:43 +00:00
Jakob Borg 3641c97667 gui, man: Update docs & translations 2017-06-21 07:45:20 +02:00
Jakob BorgandAudrius Butkevicius 8f214fe4a9 lib/config: Ignored folders that are added to the config should not remain ignored (fixes #4219)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4220
2017-06-17 18:40:28 +00:00
Jakob Borg d0061c172c gui, man: Update docs & translations 2017-06-14 07:45:21 +02:00
Jakob Borg 93a04158fd vendor: Update github.com/gogo/protobuf, keeping all files
gvt fetch -a, because we need the protobuf files etc for regeneration
2017-06-14 05:24:09 +02:00
Jakob Borg d862e79133 gui: Fix minor breakage from 9c417571 2017-06-12 08:54:08 +02:00
Jakob BorgandAudrius Butkevicius 68c1a0b9b4 lib/ignore, lib/model: Use an interface to detect file changes, improving tests
This solves the erratic test failures on model.TestIgnores by ensuring
that the ignore patterns are reloaded even in the face of unchanged
timestamps.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4208
2017-06-11 10:27:12 +00:00
Jakob Borg 2a38d2a3d2 build: Build Debian packages for non-syncthing targets (fixes #4193)
Things like the package name "syncthing" was hardcoded, which is not
awesome. With this in place we can build debs called syncthing-discosrv,
syncthing-relaysrv and syncthing-relaypoolsrv. I don't actually intend
to build and publish the relaypoolsrv, but the others can be good. Using
the "syncthing-" prefix to make the obvious "apt-cache search syncthing"
actually show them etc.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4206
LGTM: AudriusButkevicius, calmh
2017-06-09 08:53:45 +00:00
Jakob Borg 7a15fef3b8 authors, nicks: Add snugghash 2017-06-07 12:23:16 +02:00
Jakob Borg 7346113742 gui, man: Update docs & translations 2017-06-07 07:45:21 +02:00
Jakob Borg 3d11efc9e0 gui, man: Update docs & translations 2017-06-01 12:25:17 +02:00
Jakob Borg 3dca7cd694 build: Update prerelease command 2017-06-01 12:09:20 +02:00
Jakob BorgandAudrius Butkevicius 803da92ca9 cmd/syncthing: Start CPU usage monitoring not from init (fixes #4183)
Starting stuff from init() is an antipattern, and the innerProcess
variable isn't 100% reliable. We should sort out the other uses of it as
well in due time.

Also removing the hack on innerProcess as I happened to see it and the
affected versions are now <1% users.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4185
2017-05-31 18:14:04 +00:00
Jakob Borg 3959eb26fb lib/model: Events should have "folder" key, not "folderID" 2017-05-30 08:57:18 +02:00
Jakob Borg 8f3f787a34 gui, man: Update docs & translations 2017-05-18 07:47:51 +02:00
Jakob Borg cf3114b56d authors: Amend dtchanpura 2017-05-16 10:49:48 +02:00
Jakob Borg 3d95135638 authors: Add dtchanpura 2017-05-16 10:47:29 +02:00
Jakob BorgandAudrius Butkevicius 4db662e576 gui: Ensure failed items folder path contains separator (fixes #4143)
Windows specific, due to how we handle folder paths.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4149
2017-05-15 06:32:16 +00:00
Jakob Borg 1d15b8be9b cmd/syncthing: Warn when running as a super user (fixes #4123)
UID 0 on Unixes, SYSTEM SID on Windows.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4148
2017-05-15 05:42:21 +00:00
Jakob Borg d25b15263a cmd/syncthing: Process handle should be closed 2017-05-14 18:06:27 +02:00