1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2024-09-27 21:42:47 +02:00
Commit Graph

659 Commits

Author SHA1 Message Date
Kevin Ottens
712869db9a Use auto to avoiding repeating type names
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 03:54:41 +02:00
Michael Schuster
3d2de4fc40
Merge pull request #1989 from nextcloud/remove_redundant_virtual
Remove useless virtual, better use override only
2020-05-20 03:27:45 +02:00
Kevin Ottens
9328a4bba3 Remove useless virtual, better use override only
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-18 20:45:20 +02:00
Kevin Ottens
4d1ff01654 Properly handle denormalized href
In case of denormalized paths in the dav href (presence of . or .. in
the path) simple string startsWith comparison wasn't enough to know if
said href ended up in the right namespace. That's why we're now using
QUrl (pretending local file since we don't have a full URL in the href)
to normalize the path before comparison.

This could happen with broken proxies for instance where we would
wrongly validate the dav information resulting in potentially surprising
syncing and name collisions.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-18 19:33:34 +02:00
Michael Schuster
5f42813d98
Updater: Fix Tests build (failed with BUILD_UPDATER=NO)
Also don't build the test for the updater, fix missing updater library.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-10 22:10:45 +01:00
Max Rees
3d3021e3b0
Fix cmake inclusion of Qml and Quick
Signed-off-by: Max Rees <maxcrees@me.com>
2020-02-23 23:44:54 -06:00
Michael Schuster
3e255df533
Fix Tests linkage (missed UserInfo.cpp in CMakeLists.txt)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-02-14 03:12:37 +01:00
Michael Schuster
8c2d77c68f
Merge pull request #1699 from Milokita/test-file-fix
apply http2 qt resend patch from owncloud
2020-01-19 18:11:36 +01:00
Dominique Fuchs
d7a9940973 Fix failing of several tests by including ocsjob source (after its inclusion in accountstate in a previous commit)
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-16 10:53:43 +01:00
Dominique Fuchs
db92d5bfff append the correct folderwatcher (platform specific)
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-16 10:39:56 +01:00
XNG
768cf7e1ae apply http2 qt resend patch from owncloud
Signed-off-by: XNG <Milokita@users.noreply.github.com>
2019-12-25 14:36:25 +08:00
XNG
d87a88e39f apply http2 qt resend patch from owncloud
Signed-off-by: XNG <Milokita@users.noreply.github.com>
2019-12-25 14:13:03 +08:00
XNG
314c00a8b7 apply http2 qt resend patch from owncloud
Signed-off-by: XNG <Milokita@users.noreply.github.com>
2019-12-25 13:59:15 +08:00
Michael Schuster
4d5dd0f49c
Merge branch 'master' into testSyncFileStatusTracker-winPath 2019-10-20 21:33:19 +02:00
Camila San
19491ff85f
Once client gets 401/403 from the server, check if remote wipe was requested.
- When the the users logs because of 401 or 403 errors, it checks if the
server requested the remote wipe. If yes, locally deletes account and folders
connected to the account and notify the server. If no, proceeds to ask the
user to login again.
- The app password is restored in the keychain.
- WIP: The change also includes a test class for RemoteWipe.

Signed-off-by: Camila San <hello@camila.codes>
2019-10-17 20:11:31 +02:00
Camila Ayres
6c56811636
Merge branch 'master' into testSyncFileStatusTracker-winPath 2019-10-17 13:37:01 +02:00
Dominique Fuchs
f993e7c555 Fixed typo preventing successful path rename on Win and modified ASSERT for Window path styles
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-10-08 08:31:31 +02:00
asapelkin
17f39bd09d little loops optimization
Signed-off-by: asapelkin <asapelkin0x01@ya.ru>
2019-10-07 01:29:55 +03:00
Dominique Fuchs
4edab98b58
Merge branch 'master' into owncloud 2019-09-10 11:03:39 +02:00
Dominique Fuchs
07df659a3f
Merge branch 'master' into issue1216/IgnoreEmacsRecoveryFiles 2019-09-09 21:46:39 +02:00
Samir Benmendil
5e3c2d2a96 Fix fullPath matching
Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Samir Benmendil
14279104ae Read .sync_exclude.lst in each subdirectory
Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Sebastian Grund
a9bea53c89 issue1216: added sync-exclude entry for emacs recovery files
Signed-off-by: Sebastian Grund <grund92@gmx.de>
2019-05-22 08:52:37 +02:00
Joshua Sterner
bd9fcd88d8 testMove3LevelDirWithFile now uses mv function to move the directory
Signed-off-by: Joshua Sterner <joshua.s.sterner@gmail.com>
2019-05-09 04:12:33 -07:00
Joshua Sterner
b6ff17c50b Fixed Issue #1000 - Subfolders of moved folders not synced
Signed-off-by: Joshua Sterner <joshua.s.sterner@gmail.com>
2019-05-09 04:12:33 -07:00
Camila San
b5b2ef3120
Updates test to fit new configuration default value.
Signed-off-by: Camila San <hello@camila.codes>
2019-04-12 16:22:07 +02:00
Roeland Jago Douma
3b5d8f0277
Merge branch 'master' into upstream/pr/6656 2018-11-01 08:07:55 +01:00
Roeland Jago Douma
dd39887f2b
Merge pull request #641 from nextcloud/upstream/pr/6621
TestOAuth: Don't have global static QObject
2018-10-30 22:38:51 +01:00
Roeland Jago Douma
d246c1e8b9
Merge branch 'master' into upstream/pr/6485 2018-10-24 08:27:11 +02:00
Roeland Jago Douma
24606c0105
Merge branch 'master' into upstream/pr/6632 2018-10-23 22:51:12 +02:00
Roeland Jago Douma
6b7328bb87
Merge branch 'master' into upstream/pr/6632 2018-10-23 22:48:34 +02:00
Roeland Jago Douma
f3529e3dd7
Merge branch 'master' into upstream/pr/6674 2018-10-23 21:43:13 +02:00
tuxmaster5000
f9c6449c05 Fix include file 2018-10-12 15:56:26 +02:00
tuxmaster5000
3c00c09ea8 Rename owncloud tests to nextcloud 2018-10-12 14:52:18 +02:00
Olivier Goffart
08e4ba3363
Data-Fingerprint: Fix backup detection when fingerprint is empty
Add a test to test the data fingerprint feature make me realize it was broken.
The code was relying in the distinction between empty and null QByteArray,
but this was a bad idea as this difference is lost when going through QString.
2018-09-10 20:44:03 +02:00
Olivier Goffart
b3e4ec9454
FolderMan::checkPathValidityForNewFolder: make sure to work when folder points to deleted folders
Note that we also needed to adjust the server url to contains the user name
in the folder wizard. (As checkPathValidityForNewFolder expect the user name)

Issue #6654
2018-09-09 22:02:44 +02:00
Olivier Goffart
d202942a2c
Reconcile: When detecting a local move, keep the local mtime
https://github.com/owncloud/client/issues/6629#issuecomment-402450691
2018-09-09 21:38:10 +02:00
Olivier Goffart
7019f03e46
TestOAuth: Don't have global static QObject
Fix a strange warning seen on the log from the CI on Windows in
https://github.com/owncloud/client/pull/6621

The test shows, at the beginning
QObject::connect: No such signal DesktopServiceHook::destroyed(QObject*)
And crashes at the and.

My guess is that when QDesktopServices::setUrlHandler is called, the
QMetaObject is not yet initialized

But this is probably not the reason of the crash
2018-09-09 18:16:59 +02:00
Christian Kamm
cba0627a9c
Ensure GETFileJob notices finishing #6581
It could happen that readyRead was emitted for incoming data while the
download was not yet finished. Then the network job could finish with
no more data arriving - so readyRead wasn't emitted again.

To fix this, the finished signal also gets connected to the readyRead
slot.
2018-09-09 11:50:00 +02:00
Christian Kamm
2844c925eb
Show a tray message when a folder watcher becomes unreliable #6119 2018-08-28 17:04:25 +02:00
Olivier Goffart
d114212333
OwnSql: Fixup after feedback for #6388 2018-07-03 10:33:26 +02:00
Roeland Jago Douma
38b89a3fa0
Update testutility
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-28 13:37:02 +02:00
Roeland Jago Douma
6ab7e814a5
Fix tests to actually compile
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-28 13:37:02 +02:00
Christian Kamm
16ba0cf47e
Blacklist: Add unittest #6411 2018-06-11 14:50:01 +02:00
Christian Kamm
77fcff5bdf
Conflicts: Change tags to be more user friendly #6365
From "_conflict-user-yyyymmdd-hhmmss"
to   " (conflicted copy user yyyy-mm-dd hhmmss)"
2018-06-11 14:40:40 +02:00
Christian Kamm
3556482bce
TestChunkingNG: Remove unneeded test code 2018-06-07 08:53:12 +02:00
Olivier Goffart
012c638d4e
Uploads: Don't delete unexisting chunks
Since commit 4dc49ff3, we store an entry in the upload info table even
for non chunked uploads. However, if this fails we don't want to remove
non-existant stale chunks if the upload fails.

Without this commit, we would send a DELETE command to clean non-existant
chunks in the dav/uploads/ namespace.
2018-06-06 09:52:02 +02:00
Roeland Jago Douma
c1171d700e
Merge pull request #322 from nextcloud/upstream/pr/6404
Excludes: Expand doc, Desktop.ini only in root folder
2018-06-04 17:13:23 +02:00
Olivier Goffart
0443f8dd4d
csync: Simplify csync_walk_local_tree/csync_walk_remote_tree
Small refactoring
2018-06-04 15:41:38 +02:00
Roeland Jago Douma
1262cbf4ef
Merge pull request #314 from nextcloud/upstream/pr/6373
Make sure ignored and conflict files show up in the issues tab even with partial local discovery
2018-06-02 20:20:19 +02:00
Olivier Goffart
311307e8cb
Move ClientProxy and ConnecitonValidator to gui
They are using the ConfigFile and are used to control
when to sync rather than for the sync itself
2018-05-31 21:56:55 +02:00
Roeland Jago Douma
c6c42c3c70
Merge pull request #311 from nextcloud/upstream/pr/6371
Utility::fsCasePreserving: remove UNIT_TESTING ifdef
2018-05-29 20:33:34 +02:00
Roeland Jago Douma
bb1b86b087
Merge pull request #307 from nextcloud/upstream/pr/6366
test/testsyncengine: testNoLocalEncoding is for Linux
2018-05-26 21:30:21 +02:00
Roeland Jago Douma
b7d5aff901
Merge pull request #303 from nextcloud/upstream/issue/6322
SyncJournal: Don't use LIKE with paths
2018-05-18 13:56:25 +02:00
Christian Kamm
5f7fd7c551
Excludes: Expand doc, Desktop.ini only in root folder
The Desktop.ini exclude was added for 2.4 because we add such a file to
the synced folder on Windows. It doesn't need to cover subdirectories.
2018-05-16 20:29:12 +02:00
Christian Kamm
75194d1821
SyncEngine: Make "local discovery?" question available
Also fix the minor bug that was mentioned and add tests.
2018-05-16 16:46:40 +02:00
Olivier Goffart
d4aebd30de
Utility::fsCasePreserving: remove UNIT_TESTING ifdef
Since the release package will be build with unit test, we don't
want to query the env variable at every call to fsCasePreserving.
So only test the env variable at startup.
And the testutility can still change the value.

(The env variable is still used from t8.pl and maybe smashbox)

Issue #6318
2018-05-16 12:57:20 +02:00
Markus Goetz
f6b67a866a
test/testsyncengine: testNoLocalEncoding is for Linux 2018-05-15 23:06:39 +02:00
Christian Kamm
ea142b8018
Conflicts with user name: Fix tests 2018-05-15 22:54:48 +02:00
Christian Kamm
17d174e6fa
Conflicts: Add user name to conflict file name #6325
For the case of uploading conflict files only.
2018-05-15 22:38:35 +02:00
Christian Kamm
ce0e2d0b88
SyncJournal: Don't use LIKE with paths
Paths can contain the wildcards % and _ and that would lead to odd
behavior.

This patch also clarifies the behavior of avoidReadFromDbOnNextSync()
which previously dependend on whether "foo/bar" or "foo/bar/" was
passed as input.

Possibly affects #6322
2018-05-15 19:44:00 +02:00
Christian Kamm
e2b89c5afe TextXmlParse: Add truncated-xml testcase #6317 2018-01-22 14:05:08 +01:00
Christian Kamm
b9c7aa8df3 Sync: Deal with file/folder conflicts #6312
Previously conflicts with a different type on both ends lead to sync
errors. Now they are handled in the expected way: the local item gets
renamed and the remote item gets propagated downwards.

This also adds a unittest for the TYPE_CHANGE case. That one looks like
parts of it might be unified with CONFLICT cases.
2018-01-19 09:47:49 +01:00
Christian Kamm
4337e8532e Exclude matching: Speedup the full-path traversal case
Previously we'd use the full regex when the bname triggered a full-path
matching to take place. Now we have a simplified full-traversal regex
for this case that can be significantly faster to apply.

Triggered by #5017 but doesn't actually solve it.
2018-01-17 15:05:50 +01:00
Olivier Goffart
437d45981e Remove unused c_strlist 2018-01-13 13:58:17 +01:00
Olivier Goffart
3ae327ea8e Modernize out CMakeLists.txt
Mainly uses target_include_directories instead of include_directories
so libraries public include directory get automatically added when adding
the target in target_link_library
2018-01-13 13:58:17 +01:00
Olivier Goffart
5d0aa5f039 Remove unused c_path 2018-01-13 13:58:17 +01:00
Olivier Goffart
3ddd4b6f16 Get rid of csync_log
We use Qt's debugging code everywhere
2018-01-13 13:58:17 +01:00
Olivier Goffart
d948ed11a1 Csync: use QElapsedTimer and qCInfo instead of CSYNC_LOG and its own csync time function
This allow to remove all the csync time manipulation routne which are now unused
2018-01-13 13:58:17 +01:00
Olivier Goffart
257d8142b1 Build system: Get rid of QtVersionAbstraction.cmake
Use modern cmake with target_link_libraries and Qt5:: that
automatically add the include path and compile flags
2018-01-13 13:58:17 +01:00
Olivier Goffart
776bbbf7b1 Don't include sqlite3.h from headers
So that sqlite is not part of the public interface of csync
(and that the sqlite include path don't need to be passed when compiling
libsync or gui)
2018-01-13 13:58:17 +01:00
Olivier Goffart
9613f6437d Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/networkjobs.cpp
2018-01-11 10:46:50 +01:00
Christian Kamm
7d70f1becb Ignore files that can't be encoded for the filesystem
There's an upstream bug where QTextCodec::canEncode returns true even
though it should be false. This works around that issue and adds a test.

The original work was done in 72809ef5b1

See #6287, #5676, #5719
See https://bugreports.qt.io/browse/QTBUG-6925
2018-01-10 13:36:00 +01:00
Christian Kamm
585d2b20bd Exclude regex: Restore old matching on Windows #6245
Unfortunately matching behaved differently on Windows. This patch
restores the previous matching behavior but still uses the new regular
expression based matching.

Further work will hopefully unify the behavior between platforms without
breaking backwards compatibility.
2018-01-09 11:09:05 +01:00
Olivier Goffart
1940c2f9bf Exclude: Use Qt to load the exclude file
fopen does not work well with relative path tand forward slashes on windows
This fix the windows textexcludedfiles test.
And also make the code simpler.

Note that the 'trimmed' might be a behavior change, but i think it is ok
2017-12-15 19:16:20 +01:00
Christian Kamm
a7c0cfc8eb Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.

Uploaded conflict files have the following headers set during upload
  OC-Conflict: 1
  OC-ConflictBaseFileId: 172489174instanceid
  OC-ConflictBaseMtime: 1235789213
  OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.

In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.

The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.

This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
2017-12-15 18:03:53 +01:00
Christian Kamm
8eebc53728 Unify item type enum
Previously, there was csync_ftw_type_e and SyncFileItem::Type. Having
two enums lead to a bug where Type::Unknown == Type::File that went
unnoticed for a good while.

This patch keeps only a single enum.
2017-12-15 18:02:04 +01:00
Olivier Goffart
ee366df58f Fix the TestFolderMan on Windows 2017-12-15 14:51:00 +01:00
Olivier Goffart
482ee875a1 Fix TestSyncEngine on windows 2017-12-15 14:39:01 +01:00
Olivier Goffart
4dc49ff3b0 SyncEngine: Recover when the PUT reply (or chunkin's MOVE) is lost
This can happen if the upload of a file is finished, but we just got
disconnected right before recieving the reply containing the etag.
So nothing was save din the DB, and we are not sure if the server
recieved the file properly or not. Further local update of the file
will cause a conflict.

In order to fix this, store the checksum of the uploading file in
the uploadinfo table of the local db (even if there is no chunking
involved).  And when we have a conflict, check that it is not because
of this situation by checking the entry in the uploadinfo table.

Issue #5106
2017-12-14 11:56:12 +01:00
Olivier Goffart
4369853ddb TestSystem: Add QIODevice in the serverOverride function, and add a DelayedReply
Preparing to add test that needs the QIODevice.
Also make the DelayedReply so we can generalize the existing delay on FakeChunkMoveReply
to any reply.
2017-12-14 11:56:12 +01:00
Christian Kamm
e5ed8fc90a Merge remote-tracking branch 'origin/2.4' 2017-12-13 11:03:24 +01:00
Christian Kamm
dcf0baa9de Journal: 64bit inodes, fix storing uint64s generally
In addition to using the right function when retrieving inodes this
*also* fixes a more general bug ownsql had with storing uint64 values
that didn't fit into an int64.
2017-12-12 10:30:54 +01:00
Olivier Goffart
74672d493d Utility: use QUrlQuery
For QUrl::setQuery is deprecated in Qt5
2017-12-08 16:15:17 +01:00
Christian Kamm
287670c9d6 Excludes: Remove fnmatch codepath
Now all exclude patterns can be translated to regular expressions.
2017-12-07 14:38:21 +01:00
Christian Kamm
e5c780ee19 Excludes: Translate full-path patterns to regex
Improves full matches by more than an order of magnitude
and also improves speed of traversal matches by roughly 20%,
judging by the check_csync_exclude performance test.
2017-12-07 14:38:21 +01:00
Christian Kamm
1c3d5ab158 Excludes: Introduce dir-only regex matches 2017-12-07 14:38:21 +01:00
Christian Kamm
5d668eca40 Excludes: Optimize Desktop.ini check 2017-12-07 14:38:21 +01:00
Christian Kamm
7ab127ad53 Excludes: Refactor for pending improvements
Make ExcludedFiles something that is instantiated outside of
the CSYNC context and then given to it as a hook.

ExcludedFiles still lives in csync_exclude and the internal
workings haven't been touched.
2017-12-07 14:38:21 +01:00
Olivier Goffart
dd91f4a86e Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/csync/csync.cpp
2017-12-07 09:37:50 +01:00
Christian Kamm
ceac18c554 Reconcile: Rename maps are consistent with update phase #6212
For duplicate file ids the update phase and reconcile phase determined
the rename mappings independently. If they disagreed (due to different
order of processing), complicated misbehavior would result.

This patch fixes it by letting reconcile try to use the mapping that the
update phase has computed first.
2017-12-06 16:42:11 +01:00
Olivier Goffart
ed5385faa3 Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/connectionvalidator.cpp
     	src/libsync/networkjobs.cpp
2017-12-05 15:58:13 +01:00
Olivier Goffart
e0954b0999 test/syncenginetestutils.h: Don't use toTimeZone only to get the UTC 2017-12-01 13:18:09 +01:00
Olivier Goffart
96dede4e84 TestChunkingNG: Test that resuming does not send past data. 2017-11-21 11:19:14 +01:00
Christian Kamm
aafe7c4732 Merge remote-tracking branch 'origin/2.4' 2017-11-20 11:54:56 +01:00
Olivier Goffart
480932a58a Checksum: Ignore unkown OC-Checksum header when downloading...
And if there are several checksums, pick the "best" one.

The case of several checksum was reported in
https://github.com/nextcloud/client_theming/issues/213
2017-11-20 10:51:15 +01:00
Olivier Goffart
2192386d86 test/testsyncengine: test for PR #6168 2017-11-16 13:31:54 +01:00
Christian Kamm
e694ffcd03 PropagateDownload: Adjustments to skipping downloads #6153
Previously we required matching mtimes but that's actually
unnecessary when the question is about whether to skip the
download. We will still update the file's metadata.

Also, adjust behavior when the checksum is weak (Adler32):
in these cases we still depend on equal mtimes.
2017-11-16 13:31:54 +01:00
Christian Kamm
37c5612aee Discovery: Treat files starting with '.' as hidden #6145
This bug was introduced when strcmp(a, b) != 0 was accidentally
converted to a == b.
2017-11-08 12:53:46 +01:00
Christian Kamm
05c1bfb6cf Merge remote-tracking branch 'origin/2.4' 2017-10-27 10:29:31 +02:00
Jocelyn Turcotte
56e38e6f80 Windows: Add sync folders to Explorer's navigation pane
This is only the navigation pane, the SyncRootManager entries aren't handled yet.

This follows the instructions from:
https://msdn.microsoft.com/en-us/library/windows/desktop/dn889934%28v=vs.85%29.aspx

Issue #5295
2017-10-24 16:10:53 +02:00
Olivier Goffart
ee63b36ed3 SyncFileStatusTracker: Detect changed in the shared flag
... even if the file is not changed.

We get an UPDATE_METADATA in that case, so make sure we let the
SyncFileStatusTracker know about it.
That means we need to filter out UPDATE_METADATA in the other listeners
of this signal.

Issue #6098
2017-10-24 15:50:14 +02:00
Christian Kamm
9c7ee6ef85 Reconcile: Rename handling fixes: duplicate file ids
When users share the same tree several times (say A/ and A/B/ are both
shared) the remote tree can have several entries that have the same
file id. This needs to be respected in rename detection.

Also adds several tests and fixes for issues noticed during testing.

See #6096
2017-10-24 10:54:23 +02:00
Christian Kamm
e85a339d94 Local discovery: Use db instead of filesystem
We mostly trust the file watchers meaning that we don't re-scan the
local tree if we have done that recently and no file watcher events
have arrived. If the file watchers invalidate a subtree, we rescan
only that subtree.

Since we're not entirely sure the file watchers are reliable, we still
do full local discoveries regularly (1h by default). There is a config
file setting as well as an environment variable to control the interval.
2017-10-24 10:00:20 +02:00
Christian Kamm
bf39343920 Sync: Add capability for invalid filename regexes #6092 2017-10-17 17:15:49 +02:00
Christian Kamm
2ac7e0200a Test case for #5949 2017-10-17 09:44:52 +02:00
Christian Kamm
e6b971b316 TestUtils: Invalidate etags on PUT or chunk-MOVE 2017-10-17 09:44:52 +02:00
Christian Kamm
01c2ffe2ae PropagateDownload: Read Content-md5 header #6088 2017-10-11 09:06:23 +02:00
Christian Kamm
90befac901 Rename detection: File size must be equal
Comparison of file sizes for potential conflicts was added in
0eb9401c62, but did not extend to checking
the file size in case of potential local moves.

This commit adds this check and adds tests for various move+change
scenarios.
2017-10-05 14:17:07 +02:00
Christian Kamm
22f71ce17e t9.pl: Make more reliable
Sometimes the 'touch' didn't change the mtime since too little time had
passed!
2017-10-05 14:13:10 +02:00
Christian Kamm
43a26eb50a Excludes: Fix bug with escapes in the regex, add tests 2017-10-05 10:40:53 +02:00
Christian Kamm
99d406072f Excludes: optimize csync_is_windows_reserved_word 2017-10-05 10:19:48 +02:00
Markus Goetz
3a1a56c7ad Excludes: During directory traversal, use QRegularExpression
On Mac, this halves the time spent in csync_excluded_traversal
when using check_csync_excluded_performance. A similar performance
increase is seen on linux.
2017-10-05 10:19:48 +02:00
Olivier Goffart
253d197ccb fixup! [tx-robot] updated from transifex 2017-09-28 18:38:33 +02:00
Olivier Goffart
0ceb806f1a Test OAuth2
Include a test for PR #6057
2017-09-28 18:38:33 +02:00
Olivier Goffart
800b9cf167 SyncEngine: _hasNoneFiles should be set when there are INSTRUCTION_UPDATE_METADATA 2017-09-28 11:15:36 +02:00
Olivier Goffart
13e0cc6b50 Use QDateTime::currentDateTimeUtc instead of the non utc version
QDateTime::currentDateTime is terribly slow.
2017-09-26 16:14:17 +02:00
Jocelyn Turcotte
a034ee894c Use SyncJournalDb in csync
This gets rid of the csync_statedb sqlite layer and use
the same code and same connection as the rest of the SyncEngine.

Missing functions are added to SyncJournalDb and change a few minor
things (like changing SyncJournalFileRecord::_modtime to be an int64
instead of a QDateTime, like it was in csync).
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte
6f46764daa SyncJournalDB: Allow callers of getFileRecord if the query failed
The current implementation would return the same value whether the query failed
or if no row would be found. This is something that is currently checked by csync
and needs to be provided if we want to use SyncJournalDB there.

Adjusted all call sites to also check the return value even though they
could still just rely on rec.isValid(), but makes it more explicit as to what
happens for database errors in those cases, if we ever want to gracefully handle
them.
2017-09-26 11:03:23 +02:00
Olivier Goffart
2953eed729 benchlargesync: Do several syncs
Make sure there is already a small sync before so the database is queried.
Make also a sync after to run an update with many files in the database.
2017-09-25 12:49:55 +02:00
Olivier Goffart
d113498c7b chsck_vio: fix readdir test by removing it.
The code that was creating the files in the directory was removed in
commit 6906b8d30c. The directory is empty
so the result is expected to be null. It was passing before because the
code was returning an entry for . and ..,  but since commit
35f80bd439 this is no longer the case
2017-09-25 00:17:47 +02:00
Olivier Goffart
95d23b1914 RemotePermissions: Store in a class rather than in a QByteArray to save memory
Create a specific type that parses the permissions so we can store
it in a short rather than in a QByteArray

Note: in RemotePermissions::toString, we make sure the string is not
empty by adding a space, this was already existing before commit
e8f7adc7ca where it was removed by mistake.
2017-09-22 09:29:08 +02:00
Olivier Goffart
c4e51247d8 test/stub: add some call required by the next patches
As we use the new connection syntax in folderman.cpp, some more symbol
need to be mocked
2017-09-21 14:05:39 +02:00
Jocelyn Turcotte
a1f1775d15 Move SyncJournalDB to src/common 2017-09-18 14:00:52 +02:00
Jocelyn Turcotte
bd25225045 Move non-csync-dependent parts of FileSystem to src/common
This keep the csync-dependent parts in src/libsync, slitting the namespace
over two files.
This will allow moving SyncJournalDB to src/common as well.
2017-09-18 14:00:52 +02:00
Christian Kamm
78212e03d6 Checksums: Clearer behavior and added testing 2017-09-18 12:52:09 +02:00
Jocelyn Turcotte
a8ea7b0858 Remove SyncFileItem::_isDirectory
It's always equivalent to _type == SyncFileItem::Directory.
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte
0e97770c47 Remove SyncFileItem::log
This remove the remaining "other" fields of the sync log to save a
bit of memory.

other_etag and other_fileId don't give much information to the users
and other_instruction will always be INST_NONE anyway.

other_modtime and other_size are kept since they are sometimes used.
They were renamed to have a bit more meaningful name.

SyncEngine::checkPermissions will now fetch its information from the
csync trees since they are now preserved until right after this point.

Fixes #3213
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte
bfacac8683 Remove the usage of phash in csync
Only store the path since they represent the same thing, and do the
phash conversion during DB lookup like done in libsync.
We could get rid of everything since we also have an index on the path
column, but since it's the primary key this makes the migration non-trivial.
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte
d66c2b5fae Replace the custom rbtree by a std::map 2017-09-18 11:46:09 +02:00
Jocelyn Turcotte
72e44ce3d7 csync: Keep the csync_file_stat_t instances created during discovery
Now that they use the same structure, avoid _csync_detect_update
having to recreate another instance and transfer everything manually.
Any instance created during discovery should now be used all the way
up to SyncEngine::treewalkFile.

This also makes sure that the path and types are properly set in that
object instead of having to pass everything as separate parameters.

This gets rid of csync_ftw_flags_e which was now converted from,
and to csync_ftw_type_e, already in the csync_file_stat_t.

Issue #1817
2017-09-18 11:46:09 +02:00
Christian Kamm
3a55ff2119 PropagateUpload: Model of remote quota, avoid some uploads #5537
When we see a 507 error, assume that quota is < uploaded size.
2017-09-15 09:27:07 +02:00
Helmut K. C. Tessarek
709aa27031 remove qt4 code 2017-09-15 07:11:05 +02:00
Christian Kamm
0b7ad2c804 Excludes: Allow escaping # #6012
Otherwise adding patterns that start with # are impossible to add, since
they get treated as comments. Also add this escaping for patterns added
in the ui.
2017-09-14 14:53:05 +02:00
Markus Goetz
3d120983da ChunkingNgTest: CI debuggability #6015 2017-09-12 17:26:54 +02:00
Christian Kamm
4b686a4394 Fix compile errors
cmocka seems to #define fail to something inappropriate.
2017-09-07 11:02:05 +02:00
Jocelyn Turcotte
b1bb7ec1a8 Use a C++ contructor and destructor for CSYNC
Merge csync_create and csync_init into the constructor and
replace csync_destroy with the destructor.

Also use a QByteArray for csync_s::root_perms and flatten
csync_rename_s as a rename sub-struct of csync_s since it
can now handle C++ types.
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte
f6136dd036 Remove csync_s::replica
The only difference with csync_s::current is that it's
assigned the value of csync_s::local::type and
csync_s::remote::type, which never change. So might as
well only use the "current" field with constants.
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte
e8f7adc7ca Replace csync_vio_file_stat_t with csync_file_stat_t
Also move csync_normalize_etag to common/utility since we
don't need the char* function anymore.

Remove the single space file_stat->remotePerm codepath since
this won't be used in csync anymore since
8de3bda0b1.

Issue #1817
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte
704ca366b3 Make csync_file_stat_t public and partly convert to C++
This is the first commit trying to unify csync_file_stat_s,
csync_vio_file_stat_s and csync_tree_walk_file_s. Use QByteArray
and unique_ptr already since I'm not used to track memory allocations
and this will make the transition easier.

Issue #1817
2017-09-05 17:25:19 +02:00
Jocelyn Turcotte
cf15cbf0b3 Move Utility to a new common static library
Now that csync builds as C++, this will avoid having to implement
functionalities needed by csync mandatorily in csync itself.

This library is built as part of libocsync and symbols exported
through it.
This requires a relicense of Utility as LGPL. All classes moved into
this library from src/libsync will need to be relicensed as well.
2017-09-05 17:25:19 +02:00
Christian Kamm
de7c301654 Add minor unittest for numeric id extraction #5933 2017-09-05 13:40:26 +02:00
Jocelyn Turcotte
48d2fc1599 StatusTracker: Fix different case paths not matching (#5981)
Use a custom std::map comparator functor to do all comparisons
on contained QStrings using Qt::CaseInsensitive on macOS and Windows.

Issue #5257
2017-08-31 13:32:00 +02:00
Jocelyn Turcotte
7a5a706397 Fix cmocka deprecation warnings
Just use cmocka_run_group_tests like we already use in
some of those tests.
2017-08-22 15:22:57 +02:00
Jocelyn Turcotte
59ea79d9e6 Enable csync logs in unit tests
Go through the Logger to enable the csync-QDebug bridge.
2017-08-22 15:22:56 +02:00
Jocelyn Turcotte
4e5898efd7 Compile almost all of csync as C++
This will allow us to unify data structures between csync and libsync.

Utility functions like csync_time and c_std are still compiled as C
since we won't need to be coupled with Qt in the short term.
2017-08-22 15:22:56 +02:00
Jocelyn Turcotte
28a0971cdf Move csync to src/csync 2017-08-22 11:18:22 +02:00
Jocelyn Turcotte
5c9827a33c Move csync/tests to test/csync 2017-08-22 11:18:22 +02:00
Jocelyn Turcotte
f0362b2332 Move csync/tests/ownCloud to test/scripts/txpl 2017-08-22 11:18:22 +02:00
Olivier Goffart
a831164d65 Revert "Revert "Discovery: consider also the "shared by me" as shared""
This reverts commit efa7821dd2.

This reverts the revert, but also add a check that the server version
is bigger than 10.0

Issue #4788
2017-07-25 12:11:33 +02:00
Olivier Goffart
2ba46e05ee Merge pull request #5326 from owncloud/cleanup_tests
Use OWNCLOUD_BIN_DIR directly in C++ code.
2017-07-15 14:48:25 +02:00
Christian Kamm
e7a0c1b6d0 SyncEngineTest: _size now correct for uploads #5855 2017-07-12 10:09:04 +02:00
Christian Kamm
da54b3d7e5 Merge remote-tracking branch 'origin/2.3' 2017-07-12 10:06:04 +02:00
Christian Kamm
a5ace5e71d Account/Credentials: Have identical lifetimes
The QNAM may continue to outlive both.

Rename Credentials::getQNAM() to createQNAM() while we're at it - it's
used to make a new QNAM that will subsequently be owned by the Account
object.

See d01065b9a1 for rationale.

Relates to
d40c56eda5
147cf798a6
2017-07-08 13:07:13 +02:00
Christian Kamm
0238a29c7c Introduce private link sharing #5023
* SocketAPI has COPL_LOCAL_LINK / EMAIL_LOCAL_LINK commands
* The nautilus and dolphing shell integrations show a submenu from which
  one can share as well as access the private link.
* The SocketAPI provides a new GET_STRINGS command to access localized
  strings.
* The private link can also be accessed from the user/group sharing
  dialog.
* The numeric file id is extracted from the full id to create the
  private link url.
2017-07-07 10:49:51 +02:00
Hefee
607287a9d6 Use OWNCLOUD_BIN_DIR directly in C++ code.
No need to do a STR replacement and the macro changing the path.
It actually broke test execution for Debian.

See https://bugs.debian.org/844937
2017-07-06 08:41:02 +02:00
Christian Kamm
0db095e02a SyncEngineTest: Fix test reliability
There was a rounding issue in the mtimes which sometimes resulted in an
off-by-one error. Caused by storing a full QDateTime in the FileInfo but
the mtime saved to the disk being truncated to seconds.
2017-07-04 09:57:22 +02:00
Markus Goetz
f49985697b TestSyncJournalDB: Fix concurrent usage on CI 2017-07-03 14:08:39 +02:00
Christian Kamm
851a3128e4 SyncEngine: Add unittest for SyncFileItem properties #5855
Checks instruction, direction, size, modtime for three common cases.
2017-07-03 12:54:24 +02:00
Markus Goetz
59bbbd5e66 Jenkinsfile: Some comments 2017-06-22 15:42:56 +02:00
Markus Goetz
1e98ba27c6 CSyncSqliteTest: Fix test 2017-06-22 15:11:49 +02:00
Markus Goetz
2244b35a6d test_journal.db: Add checksumtype table 2017-06-22 15:11:49 +02:00
Christian Kamm
8160963110 Compare the hash of files with identical mtime/size #5589
* For conflicts where mtime and size are identical:

  a) If there's no remote checksum, skip (unchanged)
  b) If there's a remote checksum that's a useful hash, create a
     PropagateDownload job and compute the local hash. If the hashes
     are identical, don't download the file and just update metadata.

* Avoid exposing the existence of checksumTypeId beyond the database
  layer. This makes handling checksums easier in general because they
  can usually be treated as a single blob.

  This change was prompted by the difficulty of producing file_stat_t
  entries uniformly from PROPFINDs and the database.
2017-06-15 13:54:16 +02:00
Christian Kamm
d50d8b86cf SyncEngineTest: Add network override
This is useful for monitoring what kind of network requests are
sent to the fake server. Such as "did this sync cause an upload?"
and "was there a propfind for this path?". It can also inject
custom replies.
2017-06-15 13:53:57 +02:00
Christian Kamm
b28e06608c SyncEngineTest: Send 'checksums' in FakePropfind 2017-06-15 13:53:57 +02:00
Christian Kamm
cd411e5fb1 SyncEngineTest: Fix date locale related bug
The client is very picky about date strings it accepts. If dates are
formatted with a non-C locale (such as localized weekday names), it
fails to parse it and tests fail in subtle ways.
2017-06-15 13:53:57 +02:00
Olivier Goffart
3314a472c3 SyncEngine: SelectiveSync: Remove local files of undelected folder despite other modified files
Issue #5783

When the directry that should be removed by selective sync contains changes,
we ignore the whole sub tree instead of only ignoreing new files.
We cannot ignore the whole directory, we need to ignore only the directory
that do not have files to remove
2017-06-08 14:53:54 +02:00
Christian Kamm
5eaae83a01 Merge remote-tracking branch 'origin/2.3' 2017-05-17 13:10:19 +02:00
Christian Kamm
c5a0ce5a43 Selective sync: Skip excluded folders when reading db
When a new folder becomes selective-sync excluded, we already mark it
and all its parent folders with _invalid_ etags to force rediscovery.

That's not enough however. Later calls to csync_statedb_get_below_path
could still pull data about the excluded files into the remote tree.

That lead to incorrect behavior, such as uploads happening for folders
that had been explicitly excluded from sync.

To fix the problem, statedb_get_below_path is adjusted to not read the
data about excluded folders from the database.

Currently we can't wipe this data from the database outright because we
need it to determine whether the files in the excluded folder can be
wiped away or not.

See owncloud/enterprise#1965
2017-05-16 13:58:45 +02:00
Jocelyn Turcotte
4d3212b31f Merge branch 2.3 into master 2017-05-09 18:23:01 +02:00
Jocelyn Turcotte
879dadba78 Use QTemporaryDir in TestOwnSql
This will improve the cleanup and possibly help for #5366.
2017-05-08 23:18:06 +02:00
Olivier Goffart
9aeb587d6c Require Qt5 2017-04-20 09:39:41 +02:00
Olivier Goffart
1ed4eb46f2 Merge remote-tracking branch 'origin/2.3'
Conflicts:
	VERSION.cmake
2017-04-13 10:19:35 +02:00
Christian Kamm
6abc2bf72d Transfers: Show a decimal for single digit MB rates #4428 2017-04-04 09:54:06 +02:00
Christian Kamm
f67989afea Wizards: Never propose an existing folder for syncing #5597 2017-03-21 17:07:35 +01:00
Olivier Goffart
1a98b49f1b Fix TestSyncEngine::testDirDownloadWithError
On master, the scheduling is different and the tasks abort in another
order
2017-03-09 10:35:58 +01:00
Olivier Goffart
0e8f0481d4 Merge remote-tracking branch 'origin/2.3'
Conflicts:
	src/libsync/owncloudpropagator.cpp
2017-03-09 09:54:14 +01:00
Christian Kamm
4a1a5fa076 AbstractNetworkJob: Improve redirect handling #5555
* For requests:
  - reuse the original QNetworkRequest, so headers and attributes
    are the same as in the original request
  - determine the original http method from the reply and the request
    attributes
  - keep the original request body around such that it can be sent
    again in case the request is redirected

* Simplify the interface that is used for creating new requests in
  AbstractNetworkJob.
2017-03-07 13:18:01 +01:00
Olivier Goffart
f862c626a1 Propagator: Fix finished signal of directory being emited twice and causing crash
When there is a FatalError, we ended up emiting the finished signal for
the directory job several times, which would lead to crashes

Issue #5578
2017-03-06 16:14:04 +01:00
Jocelyn Turcotte
ddb6b3b262 Fix TestSyncEngine::abortAfterFailedMkdir (again)
It could be possible that _firstJob is marked as finished if
aborted before its parent PropagateDirectory was marked as finished,
allowing a posted scheduleNextJob call to schedule the child job
in-between.
2017-02-23 17:54:33 +01:00
Jocelyn Turcotte
824be789bf Revert "Fix TestSyncEngine::abortAfterFailedMkdir"
This reverts commit 1cec2ca13d
but keeps the reset() -> take() part that is probably the cause
of crashes we've seen in the crash reporter.
2017-02-17 14:06:30 +01:00
Olivier Goffart
e8c10501a5 Folder: Keep files option after aboutToRemoveAllFiles should not clear selective sync list (#5531)
We were removing the wholme journal db when the user wanted to keep all files,
But that would also remove the selective sync lists.
We should only remove the metadata table.

Issue #5484
2017-02-15 13:27:41 +01:00
Olivier Goffart
172689d35c Merge remote-tracking branch 'origin/2.3' 2017-02-14 15:08:10 +01:00
Jocelyn Turcotte
60a4a742a3 Disable tests uncompatible with Qt4 for that build 2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
b26db062d2 Fix the UNIT_TESTING build on Windows
- Put all tests in the bin directory so that DLLs can be loaded
- Add missing exports
- Skip tests that use code depending on zlib
- The "GMT" timezone is named differently, use the int constructor instead

5 tests are still failing, it's not really worth fixing at the moment
since no developper is currently using Windows as its main platform.
2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
611f633ba8 Fix FolderManTest on macOS
On macOS /var is a symlink to /private/var and we have to make sure that we
use the canonical path before and after it enters the code to make sure we
compare paths correctly.
2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
3265948458 Fix ExcludedFilesTest on macOS
Use the same logic to find sync-exclude as check_csync_exclude.c
2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
0e3e9d5991 Fix FileSystemTest on macOS 2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
0be6cd3bf7 Fix FolderWatcherTest on macOS and Windows
- We need to use a QGuiApplication on macOS or else we don't get notifications
- Switch to use QSignalSpy rather than lists and sleeps
- Use system() for all modifications since we pass kFSEventStreamCreateFlagIgnoreSelf
- Keep using the local process on Windows since it catches its own events
2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
867b78052d Fix UtilityTest on macOS 2017-02-14 14:32:41 +01:00
Jocelyn Turcotte
1cec2ca13d Fix TestSyncEngine::abortAfterFailedMkdir
It could be possible that _firstJob is marked as finished if
aborted before its parent PropagateDirectory was marked as finished,
allowing a posted scheduleNextJob call to schedule the child job
in-between.
2017-02-08 17:32:04 +01:00
Jocelyn Turcotte
1d9e08d109 Skip TestSyncEngine::abortAfterFailedMkdir 2017-02-08 17:25:32 +01:00
Markus Goetz
df773ea8bb CentOS: More build fixes 2017-02-08 11:39:28 +01:00
Markus Goetz
9614a94035 Revert "Disable RTTI"
This reverts commit 85d3de1589.
This breaks our old Qt on CentOS.

We can re-introduce this with #5470
2017-02-07 17:35:04 +01:00
Piotr Mrówczyński
c3ae5123cb Delete finished propagation jobs in PropagateDirectory #5269 (#5400) 2017-01-26 10:03:22 +01:00
Jocelyn Turcotte
1fc5a76622 Pass the SyncFileItem as SyncFileItemPtr in itemCompleted
This will allow us to keep a reference on the items in connected slots.
2017-01-25 23:26:23 +01:00
Jocelyn Turcotte
a764d7eb86 Don't pass the PropagatorJob in itemCompleted
This was to catch duplicate emissions for PropagateDirectory but we
don't emit this signal anymore from there.
This fixes a warning about PropagatorJob not being a registered metatype.

This reverts commit fe42c1a818.
2017-01-25 23:26:23 +01:00
Jocelyn Turcotte
605a18ff73 Tests: Add a large sync benchmark
This simulates a ~50k files sync that can be used to measure memory
usage without having to wait for a server.
2017-01-25 23:26:23 +01:00
Olivier Goffart
268fc97a71 Merge pull request #5480 from owncloud/chunking-ng-cleanup
Chunking ng cleanup
2017-01-25 19:19:48 +01:00
Olivier Goffart
d6fdda8efa ChunkingNG: add '0' padding on the filename (#5476)
The server sorts the chunk by name alphabetically. So if we want to keep
the chunk in order, we need to add a few '0' in front of the chunk name
2017-01-20 16:03:50 +01:00
Olivier Goffart
8a70d22af7 ChunkingNG: Add some tests
- Test that we recover correctly if the chunks were removed on the server.
 - Test changing the file localy while uploading.
2017-01-20 14:48:53 +01:00
Olivier Goffart
a63d970e5e ChunkingNG: remove stale chunks when cleaning the uploadInfo table
Stale chunks might be there because a file was removed or would just not
be uploaded, for any reason.
We just start the DeleteJob but we don't care if it success or not.

Relates to https://github.com/owncloud/core/issues/26981

One of the test is testing the case where the file is modified on the server
during the upload. So this test the precondition failed error.
The FakeGetReply logic was modified because resizing a 150MB big QByteArray
by increment of 16k just did not scale when downloading a big file.
2017-01-20 14:48:53 +01:00
Olivier Goffart
f6c77fad17 ChunkingNG: delete stale chunks if the file was changed locally
Relates to https://github.com/owncloud/core/issues/26981

We do not track the success or error of the DeleteJob because it does not
matter. If it fails, it might be because the chunks were already removed.
If not, the chunks will be stale, but the server must anyway do a few
cleanup from time to time because we do not always remove the chunks
2017-01-20 14:48:53 +01:00
Jocelyn Turcotte
b68a28de8d StatusTracker: Emit OK for the last child before parents (#5467)
The current logic tried to avoid a DB lookup just to fetch whether
the file is shared or not since that info is already in the
SyncFileItem. The implementation would however need to decrease the
sync count for itself (and parents) before emitting the new status,
thus emitting the OK status for parents before that last child that
ended the propagation for that folder.

Change the implementation to achieve what we want: give the
possibility to decSyncCount to use a pre-fetched sharing state while
still doing the emission for all involved files. This ensures that
the leaf file also gets its status emitted before its parents.

Issue #4797
2017-01-18 15:40:52 +01:00
Markus Goetz
85d3de1589 Disable RTTI
Shrinks owncloud binary by 24 KB and libowncloudsync by 14 KB.
I don't know if it has influence on memory usage or runtime speed though.

Was worth a try.
2017-01-17 14:52:10 +01:00
ckamm
d76e0ec6d8 Reset stuck chunked uploads eventually #5344 (#5443)
Previously this wasn't happening for errors that were not
NormalErrors because they don't end up in the blacklist.

This revises the resetting logic to be independent of the
error blacklist and make use of UploadInfo::errorCount
instead.

412 errors should reset chunked uploads because they might be
indicative of a checksum error.

Additionally, server bugs might require that additional
errors cause an upload reset. To allow that, a new capability
is added that can be used to advise the client about this.
2017-01-13 14:44:45 +01:00
Christian Kamm
6775292d63 Fix compile of tests 2017-01-03 10:52:39 +01:00
Christian Kamm
13e624c38f Fix compilation with Qt < 5.1
For review of #5045
2016-11-29 10:39:08 +01:00
Christian Kamm
49f8143f00 Bugfixes for sync journal name generation and usage
* Use 'user' value for journal name generation
* Save journal name in settings
* Make owncloudcmd choose the right db
2016-11-23 16:48:15 +01:00
Christian Kamm
9641c7a1e7 Rename sync journal to ._sync_xxx.db.
The added underscore means that older clients will also ignore the
file.
2016-11-23 16:48:15 +01:00
Christian Kamm
3e59a9b316 Merge branch 'master' into dbjournal_per_account 2016-11-23 16:47:56 +01:00
Olivier Goffart
a1dc4069c9 libsync: Don't store the remote URI in the csync or in the SyncEngine
We are going to change the webdav path depending on the capabilities.
But the SyncEngine and csync might have been created before the capabilities
are retrieved.

The main raison why we gave the path to the sync engine was to pass it to csync.
But the thing is that csync don't need anymore this url as everything is done by the
discovery classes in libsync that use the network jobs that use the account for the urls.
So csync do not need the remote URI.

shortenFilename in folderstatusmodel.cpp was useless because the string is the
_file of a SyncFileItem which is the relative file name, that name never
starts with owncloud://.

All the csync test creates the folder because csync use to check if the folder
exists. But we don't need to do that anymore
2016-11-21 08:09:11 +01:00
ckamm
ec7333a4bf Merge pull request #5272 from owncloud/licensefix-pending
License: Adjust license of GPLv2 source files to GPLv2+
2016-11-18 15:14:47 +01:00
Olivier Goffart
efa7821dd2 Revert "Discovery: consider also the "shared by me" as shared"
This reverts pull request 5313 (commit
2d6e473a40 and
2f3db04e87)

The problem is that this loads the server too much.
2016-11-16 17:45:40 +01:00
Markus Goetz
52552a4204 Merge pull request #5102 from owncloud/chunking-ng
Chunking ng
2016-11-15 15:56:52 +01:00
Olivier Goffart
2f3db04e87 Rename SyncFileStatus::sharedWithMe to shared
Last commit for issue #4788 made the meaning to be simply shared
(with the user or from the user)
2016-11-15 14:32:20 +01:00
Olivier Goffart
2d6e473a40 Discovery: consider also the "shared by me" as shared
The "S" in the permission is only for the "Shared with me" files.
It is only used to show the shared status in the overlay icons.
But we also wish to show the shared status for files that are shared
"by" the users. We can find that out using the 'share-types' webdav
property. If set, then we are sharing the object.
We fake a 'S' in the permission as for our purpose, they mean the same.

Issue #4788
2016-11-15 14:32:20 +01:00
Olivier Goffart
92027e8692 SyncEngineTestUtils: Do don't allocate a buffer for the whole file
As the file can be some hunreds of megabytes, allocating such big arrays may
cause problems.

Also make the timeout a bit bigger so the test can rununder valgrind.
2016-11-15 11:39:40 +01:00
Christian Kamm
b0c45cfc89 Test: Don't fail when DST change is near #5284 2016-11-08 11:13:19 +01:00
Olivier Goffart
15f2b911d9 ChunkingNG: remove stale files when resuming 2016-11-04 16:43:01 +01:00
Olivier Goffart
c8014a0afd ChunkingNG: Add Test 2016-10-31 15:16:53 +01:00
Christian Kamm
10644d3568 Move concatUrl and settingsWithGroup to Utility
There was little reason to keep them cluttering Account.
2016-10-25 12:05:28 +02:00
Christian Kamm
cf48ea2e00 Remove unused functions
Account::changed and AbstractCredentials::changed have not been needed
in a long while.
2016-10-25 11:33:38 +02:00
Christian Kamm
db24f60ae3 License: Adjust license of GPLv2 source files to GPLv2+
See #5180
2016-10-25 11:06:54 +02:00
Olivier Goffart
766d9ae1ac QProgressIndicator: update copy from upstream
Update from commit 05ce8a23cdc12e825532dc6de06c267fb8d48b4f from
https://github.com/dragotin/QProgressIndicator
Which itself is forked from commit e5ba0fd09bfd43b067ee3646d70b294c7efcb558 from
upstream, with additional license header.

It was relicensed to MIT according to
14bb9d10e2

Relates to issues #5180 and #5184
2016-10-13 12:05:59 +02:00
Klaas Freitag
27d23edacc Utility: Add a function to check if two filenames are equal plus test.
It calls canonical path always and works with the correct case preserving
depending on the platform.
2016-10-12 14:48:00 +02:00
Olivier Goffart
d80d5a8ee4 SyncEngine: Fix renaming a folder should keep the selective sync state
Issue #5224

Two problems:

 - In the discovery phase, we need to check the selective sync entries of
   the source path in case of renames.

 - When the rename is done, we need to actually update the black list in the
   database.
2016-10-11 14:38:25 +02:00
Olivier Goffart
e0a36ab313 TestFolderMan: don't pollute user's settings 2016-10-11 14:27:14 +02:00
Klaas Freitag
5d13f9290f Fix the folderman test, adopting the checkPathValidity method tests. 2016-10-07 16:24:09 +02:00
Olivier Goffart
85b8ab178e SyncEngine: Fix renaming of folder when file are changed (#5195)
Two bugs:
 - The change filed are not considered as move, they are re-downloaded
   but the old file was not removed from the database. The change in
   owncloudpropagator.cpp takes care of removing the old entries.

 - Next sync would then remove the file in the server in the old folder
   This was not a problem until we start reusing the sync engine, and
   that the _renamedFolders map is not cleared. We were before deleting
   a non-existing file. But now we delete the actual file.

Also improve the tests to be able to do move on the server.
This include support for file id.

Issue #5192
2016-09-22 09:02:47 +02:00
Jocelyn Turcotte
a221ac1e4d Fix unit testing build warning on Linux
The compiler complained about the PathComponent reference on the lambdas comes from the anonymous namespace.
2016-09-16 17:55:28 +02:00
Jocelyn Turcotte
b28123bed9 Fix the Qt4 unit testing build 2016-08-18 10:34:07 +02:00
Jocelyn Turcotte
efb6b8c2c9 [overlays] Fix folders appearing as OK even though children are still syncing #4797
This would happen if the directory would first need to be created
through an mkdir propagation job. This job's itemCompleted signal
would trigger the directory to show as SYNC even though its children
are still propagating.

Fix the issue by tracking the sync count for each file, affecting
its parents. This allows us to get rid of the O(n) vector lookup
for each status query, and properly track the hierachical sync
status of a directory.

This also removes the itemCompleted signal emission from the
PropagateDirectory job. Since we only needed for overlay icons, and
since this job doesn't do any direct propagation, we can remove it
to ensure that we won't call itemCompleted twice for the item attached
to Propagate*Mkdir jobs (since the PropagateDirectory is backed by
the same SyncFileItem, instruction and status).
2016-08-17 15:40:02 +02:00
Jocelyn Turcotte
82ef1bcfe0 Make sure that we invalidate parents on blacklisted items
Add a missing call that we currently only do in slotItemCompleted.
This would normally only affect the first sync and would have
gotten properly update at the end of the sync anyway.
2016-08-17 15:39:30 +02:00
Jocelyn Turcotte
b7ff4a76e8 Add TestSyncEngine and TestSyncFileStatusTracker auto tests
To be able to test the SyncEngine efficiently, a set of server
mocking classes have been implemented on top of QNetworkAccessManager.

The local disk side hasn't been mocked since this would require adding
a large abstraction layer in csync. The SyncEngine is instead pointed
to a different temporary dir in each test and we test by interacting
with files in this directory instead.

The FakeFolder object wraps the SyncEngine with those abstractions
and allow controlling the local files, and the fake remote state
through the FileModifier interface, using a FileInfo tree structure
for the remote-side implementation as well as feeding and comparing
the states on both side in tests.

Tests run fast and require no setup to be run, but each server feature
that we want to test on the client side needs to be implemented in
this fake objects library. For example, the OC-FileId header isn't
set as of this commit, and we can't test the file move logic properly
without implementing it first.

The TestSyncFileStatusTracker tests already contain a few QEXPECT_FAIL
for what I esteem being issues that need to be fixed in order to catch
up on our test coverage without making this patch too huge.
2016-08-17 15:39:30 +02:00
Klaas Freitag
78caa1a712 Fix tests for syncjournaldb 2016-07-17 21:10:07 +02:00
Olivier Goffart
927a8b5071 Qt4: don't require a X server in the tests
Previous commit was not enough
2016-07-12 11:07:12 +02:00
Olivier Goffart
a4310f0f5c Qt4: don't require a X server in the tests 2016-07-11 14:04:58 +02:00
Christian Kamm
6d02d76cfd Fix compile warnings in tests 2016-06-07 09:43:04 +02:00
hefee
669a72f0e1 A final release version number breaks this regex (#4835)
f.ex. a valid verson nr: 2.2.0
-> fist \d+ = 2
-> second \d+ = 2
-> the last \d+ = 0
-> .+ in not matching, because there is nothing to match
2016-05-13 16:55:11 +02:00
Hefee
edb3759684 For tests we do not need a xserver running.
Use for tests QTEST_GUILESS_MAIN and QTEST_APPLESS_MAIN.
2016-05-12 11:34:21 +02:00
Christian Kamm
8934979ba1 timeAgo test: Fix for qt4, clean up 2016-05-12 09:25:15 +02:00
Klaas Freitag
9b1f46e560 Fix exclude unit test, adopt to new Iface of isExcluded. 2016-05-10 16:46:08 +02:00
Klaas Freitag
9e7a8e619b Fix utility test: Pass a command name to do the version check. 2016-05-10 16:26:42 +02:00
ckamm
e6b937f508 LockWatcher: Keep an eye on Windows file locks (#4758)
When a conflict-rename or a temporary-rename fails, notify the
LockWatcher. It'll regularly check whether the file has become
accesible again. When it has, another sync is triggered.

owncloud/enterprise#1288
2016-04-29 16:14:18 +02:00
Daniel Molkentin
e29d7e0128 Use QTokenizer to properly parse netrc
Addresses #4691
2016-04-21 12:46:03 +02:00
Christian Kamm
844777d43f Fix unit test build 2016-04-12 13:43:17 +02:00
Jocelyn Turcotte
f427955512 Simplify the build of auto tests
Remove all configure_files:
- Move all tests to cpp files
- Use the QTEST_MAIN macro instead of a generated main.cpp
- Include test*.moc in the cpp to let CMAKE_AUTOMOC call moc
- Pass info through add_definitions instead of generating oc_bin.h with them

This makes sure that build errors points to the original test source
file instead of the generated one in the build directory to be able to
jump and fix errors directly from the IDE's error pane.
2016-03-30 18:00:22 +02:00
Olivier Goffart
cdbc25ede8 Merge pull request #4615 from owncloud/socketApiRefactor
Socket API refactor
2016-03-30 13:24:10 +02:00
Christian Kamm
41f43feecf Add utility function for shorter time duration strings #3403 2016-03-29 12:26:09 +02:00
Christian Kamm
4915bbf8f3 Adjust size description strings #3403
@jancorchardt suggested to not have decimal places on file
sizes, except for GB.
2016-03-29 12:26:09 +02:00
Jocelyn Turcotte
df386b64ba Make the AccountState a construction argument of the Folder
This will help moving the SyncEngine construction in the constructor
and allow moving functionalities from Folder to SyncEngine or its
delegated objects.
2016-03-28 13:07:28 +02:00
Olivier Goffart
54612455e6 Merge pull request #4513 from owncloud/csyncContextToSyncEngine
Move the csync_context creation in SyncEngine
2016-03-08 18:12:31 +01:00
Christian Kamm
d521232587 AccountState: Allow storing state in settings
This will be useful if we ever want to store account-level gui state.
I built this originally because I thought a paused account would be
this kind of state.
2016-03-01 16:08:23 +01:00
Jocelyn Turcotte
75c99bf2b1 Fix TestXmlParse::testParser1 2016-02-25 20:53:13 +01:00
Klaas Freitag
e846b36bf6 Tests: Add a test for the timeAgoInWords function 2016-02-15 17:59:24 +01:00
Klaas Freitag
e3a846bb1f SyncJournalTest: Use valid time for the tests. 2015-11-25 22:16:29 +01:00
Klaas Freitag
aaa5c1bc5f Test syncjournaldb: Fix comparison of two QDateTime objects.
Only compare full seconds as milliseconds may float.
2015-11-25 21:13:50 +01:00
Christian Kamm
10db6cee6c Rename files 2015-11-23 12:09:25 +01:00
Christian Kamm
a25f094c4c Checksums: Don't reupload if size and checksum are unchanged #3235
* Compute the content checksum (in addition to the optional
  transmission checksum) during upload (.eml files only)

* Add hook to compute and compare the checksum in csync_update

* Add content checksum to database, remove transmission checksum
2015-11-23 11:59:56 +01:00
Christian Kamm
eb3388de68 Fix OwnSql test
3993a7f636 added asserts for failing
prepare() calls
2015-11-11 09:42:31 +01:00
Christian Kamm
25c177ca3b SyncJournalFileRecord: Remove unused mode field 2015-11-11 09:42:31 +01:00
Christian Kamm
17dd199cba Checksums: Treat more carefully in db #4034
In particular, preserve them on local rename or remote move.
2015-11-10 15:05:00 +01:00
ckamm
251679253a Merge pull request #3951 from ckamm/checksum
Checksums stored in database #3735
2015-10-29 10:40:24 +01:00
Christian Kamm
496b1e907d Checksum: Don't lose it on metadata update #3735
Also improve tests.
2015-10-28 14:49:55 +01:00
Christian Kamm
b7823dc648 Checksum: Put checksum type into separate column #3735 2015-10-28 14:46:20 +01:00
Markus Goetz
a6c9e8c5b4 Merge branch 'kill_legacy_propagator' 2015-10-28 11:06:50 +01:00
Christian Kamm
0354289795 Checksums: Improvement in async computation and validation #3735 2015-10-28 09:56:39 +01:00
Olivier Goffart
455c3ae57d test/CMakeLists.txt: remove comments 2015-10-22 12:32:53 +02:00
Olivier Goffart
9c388787bb csync_update: Don't fetch the etag in the local discovery from the DB
We don't need it, and it's slow.
This saves a lot of DB queries

(Also replaced a strlen>0 with a faster check)
2015-10-21 16:38:26 +02:00
Markus Goetz
c8590c4468 Remove legacy propagator and neon
The code was already uneeded/unbuilt on Windows and OS X.
2015-10-20 17:57:43 +02:00
Christian Kamm
6e09e3af86 Fix test compile
I regularly fix errors in the copies of the test sources that are
made in build/. Refactoring how these tests work could be worthwhile.
2015-10-15 15:52:58 +02:00
Christian Kamm
abd63035c1 ETag: Allow parsing of weak tags #3946 2015-10-15 14:57:34 +02:00
Christian Kamm
225da68832 ExcludedFiles: Add test 2015-10-13 15:01:59 +02:00
Christian Kamm
7d1886684e FolderWatcher: Use csync exclude code #3805
Introduce a global ExcludedFiles instance to avoid loading the global
exclude lists several times.

One could still add per-folder exclude lists by checking these after
the global ones.
2015-10-02 15:56:39 +02:00
Christian Kamm
efefc2d986 Merge branch '2.0'
Conflicts:
	doc/images/menu.png
	doc/images/settings_network.png
2015-10-02 15:44:50 +02:00
Klaas Freitag
9004fd6d11 Utility: Fix the size display back to JEDEC standard.
Also updated the test.
2015-09-10 17:36:28 +02:00
Phil Davis
13b6b3989a Minor typos in client test section
Note: I am not sure that nostoredpasswd even exists in the current
version. Maybe the stuff in testplan.txt is old and not relevant anyway?
2015-09-10 18:11:44 +05:45
Jocelyn Turcotte
94a57fe8d5 Get rid of ShibbolethRefresher
This is only for neon and not necessary if we want to show a notification
instead of a login window when the network reports invalid credentials.
2015-09-05 15:45:54 +02:00
Daniel Molkentin
df625f0d49 Make version check test conditional for now 2015-08-07 12:42:18 +02:00
Daniel Molkentin
6a20ea5e73 Merge pull request #3472 from owncloud/linux_restart_on_new_version
On Linux restart if new version is found on disk
2015-08-06 17:47:10 +02:00
Markus Goetz
aee20e0ed3 1.8 Migration: Fix password overwrite #3539 2015-08-06 12:49:18 +02:00
Daniel Molkentin
72b2c52e15 Merge branch 'master' into linux_restart_on_new_version
Conflicts:
	src/gui/application.cpp
	src/gui/owncloudsetupwizard.cpp
2015-08-06 11:11:52 +02:00
Olivier Goffart
8ec4d0f19b Utility: use SI units for the sizes in bytes 2015-08-05 16:22:09 +02:00
Markus Goetz
ad9ef0493e FolderManTest: Make compile 2015-08-04 16:55:10 +02:00
Klaas Freitag
2a22cec442 test Utility: really check for a version string. 2015-07-31 15:38:01 +02:00
Klaas Freitag
579e24be10 Tests: Make independent of an hardcoded path, rather use CMAKE_BINARY_DIR. 2015-07-31 15:28:31 +02:00
Jocelyn Turcotte
6d522a1467 Fix the tests build on OS X in debug 2015-07-28 15:19:09 +02:00
Olivier Goffart
ec86d1a151 Wizards: allow adding a folder in a non-existing directory and create that folder
The owncloud wizard already created the directory, but the recent addition
of FolderMan::checkPathValidityForNewFolder stopped allowing unexisting directories.

So change FolderMan::checkPathValidityForNewFolder to allow non existing directory
and whange the FolderWizard to create the directory if it does not exist.

Issue #3492
2015-07-28 12:14:52 +02:00
Olivier Goffart
28ab3666d3 Tests: Some tests need QtWidgets 2015-07-27 11:04:49 +02:00
Klaas Freitag
2f2ae09190 Utility: Added function versionOfInstalledBinary()
It calls the binary with param --version and returns the first line of
the output. For owncloud, that is the version string.
2015-07-16 18:16:16 +02:00
Christian Kamm
3b0f76f853 Fix test build... again.
The issue was unrelated to moc! We just need to make sure QT_VERSION
etc. are actually defined when we use them for a test!
2015-07-15 09:47:42 +02:00
Christian Kamm
89df528090 Fix test build.
The older moc doesn't expand macros and wouldn't evaluate
QT_VERSION_CHECK.
2015-07-15 09:26:39 +02:00
Olivier Goffart
371fc0ffa2 Qt4 test build: QTemporaryDir only exist since Qt5
Disable that test for older versions of Qt
2015-07-14 15:06:42 +02:00
Olivier Goffart
4dbe0693df FolderMan::checkPathValidityForNewFolder
factorize the function to check the validity of a new folder out of
the folder wizard to the FolderMan.

There is even a test for it now.

That way we can also use it in the normal wizard
2015-07-13 14:35:19 +02:00
Olivier Goffart
7a324ff25b Utility: improve the function to conver a duration to string
- Make it translatable
 - Make use of the %n so that it supports plurals (but this will only
   take effect if we have an english translation)
 - Only put two units.  eg:  "5 years 7 months" instead of
   "5 years 7 months 12 days 34 minutes 23 seconds"
   Even when it is "2 hours 23 minutes" the amount of second does not
   matter, especially since the estimation is likely to be boggus anyway

Issues #2672 and #3097
2015-06-29 14:59:28 +02:00
Olivier Goffart
7332afa171 Fix Qt4 build
QTRY_VERIFY was private API in Qt4
2015-06-25 14:39:48 +02:00
Olivier Goffart
d7555cc14e Test for transchecksumvalidator: Do not use arbitrary waiting time
Just stop the loop when we have the result.

This will hopefully fix the jenkins build
2015-06-25 12:45:09 +02:00
Olivier Goffart
6b27d2e703 Merge remote-tracking branch 'origin/1.8' 2015-05-26 12:28:31 +02:00
Olivier Goffart
6b9e123816 Merge remote-tracking branch 'origin/checksum_1.8' into 1.8 2015-05-22 10:32:37 +02:00