Commit graph

222 commits

Author SHA1 Message Date
Klaas Freitag
654e87a9d5 Fix temp name creation: Place dot correctly for hidden files. 2012-12-12 14:18:30 +01:00
Markus Goetz
fded216fb6 Propagate: Fix file name pattern
Starting with dot on Windows is a bad idea
2012-12-11 17:26:46 +01:00
Klaas Freitag
8ed89bca86 Hide temp files for download to local. 2012-12-11 11:35:38 +01:00
Markus Goetz
42b090ec0d Propagate: Change temp file name
.. to something already in the exclude list
2012-12-10 19:15:16 +01:00
Markus Goetz
885e073b8a Win32: Hide file while downloading 2012-12-10 19:15:16 +01:00
Olivier Goffart
58aaf98369 Only request the id for REMOTE_REPLICA after mkdir 2012-12-08 11:06:29 +01:00
Olivier Goffart
5bdaf83c67 Don't remove trailing slash
There is no trailing slashes in the path
2012-12-06 16:42:22 +01:00
Olivier Goffart
0eb1855345 Revert "Only refresh the folder id for remote replica"
This reverts commit ce94beb068.

This broke because the tree are not merged yet.
If a file was added on the remote, it is not yet in the remote tree, and
still we need to query the ETag
2012-12-06 16:36:13 +01:00
Olivier Goffart
b989518af3 Only request file id for remote replica 2012-12-06 16:28:37 +01:00
Olivier Goffart
7b4e4f349e No need to query the id again after syncing the dir
If there was a change, then a file would be changed, and we would do that anyway,
If there was no change, it is a waste to do it
2012-12-06 14:59:26 +01:00
Klaas Freitag
6d9bd79ccb Cleanup and fix == error. 2012-12-06 11:39:53 +01:00
Olivier Goffart
ce94beb068 Only refresh the folder id for remote replica
Also don't remove trailing slash, there is no trailing slashes in the
path
2012-12-05 18:18:45 +01:00
Klaas Freitag
41c4e05b93 Fix error reporting from sendfile method. 2012-12-05 14:19:22 +01:00
Klaas Freitag
0d4c824fbf Add sendfile method including a module capability. 2012-12-04 15:03:49 +01:00
Olivier Goffart
95edd6a9de Merge remote-tracking branch 'origin/master' into dav
Conflicts:
	config/ocsync_log.conf
	src/csync.c
	src/csync.h
	src/csync_config.c
	src/csync_log.h
	src/csync_private.h
	src/csync_statedb.c
	tests/csync_tests/check_csync_config.c
2012-12-03 17:32:08 +01:00
Klaas Freitag
9c1893fa6d Fix for #123: Move declaration to top of function to escape goto. 2012-11-29 13:38:28 +01:00
Klaas Freitag
24e137ca19 Detect loop in mkdir function to prevent looping in readonly Shared. 2012-11-21 14:53:54 +01:00
Klaas Freitag
3265e2c6a2 Handle PUT fail correctly. 2012-11-16 12:31:09 +01:00
Andreas Schneider
8a0b4319d3 csync: Add a new logging system. 2012-10-30 11:27:21 +01:00
Klaas Freitag
2bb52ef6f9 Merge branch 'master' into dav - get cmocka tests and database move.
Conflicts:
	CMakeLists.txt
	cmake/Modules/FindCMocka.cmake
	src/csync.c
	src/csync_exclude.c
	src/csync_reconcile.c
	src/csync_statedb.c
	src/csync_update.c
	src/csync_util.c
	src/vio/csync_vio.c
	tests/CMakeLists.txt
	tests/csync_tests/check_csync_exclude.c
	tests/csync_tests/check_csync_statedb_load.c
	tests/csync_tests/check_csync_statedb_query.c
	tests/csync_tests/check_csync_update.c
	tests/std_tests/check_std_c_path.c
2012-10-27 19:27:14 +02:00
Andreas Schneider
06cb39e1e1 propagate: Fix a possible null pointer deference.
Found by Coverity.
2012-10-19 19:07:15 +02:00
Benjamin Legrand
cb8a501241 Fix a typeo and rename REPLCIA to REPLICA.
BUG #8

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2012-10-19 15:59:51 +02:00
Klaas Freitag
aad8e5320a Some more memory cleanups after valgrinding. 2012-10-18 13:26:44 +02:00
Andreas Schneider
2ddccf6c16 propagate: Fix build on systems without atime support.
This fixes bug #6.
2012-10-15 21:27:17 +02:00
Klaas Freitag
004f5ccce6 Fix state change for deleted or not longer existing directories. 2012-09-26 12:46:59 +02:00
Klaas Freitag
77e79ea767 For rename, retrieve the new id and set in local tree. 2012-09-24 15:55:18 +03:00
Klaas Freitag
128926cac7 Check path for len exactly 1 when comparing on '.'. 2012-09-24 15:54:17 +03:00
Klaas Freitag
d756c45c50 Free memory used by the id in csync_file_stat. 2012-08-30 13:01:21 +03:00
Klaas Freitag
97a7e46595 Set to INSTRUCTION_UPDATED only for NONE instructions. 2012-08-23 17:44:07 +03:00
Klaas Freitag
868a07c322 Update the md5 also if the instruction is not UPDATE. 2012-08-23 17:44:07 +03:00
Klaas Freitag
f4c9ced446 Handle ID change propagation to the top directory. 2012-08-23 17:43:51 +03:00
Klaas Freitag
c2e2f8de00 more md5 calculations 2012-08-23 17:41:53 +03:00
Klaas Freitag
ae1b8a5682 Query new id for local repository because of utimes changes. 2012-08-23 17:41:53 +03:00
Klaas Freitag
0618eb956d Merge conflicts solved. 2012-08-23 17:40:36 +03:00
Klaas Freitag
ae5394ad75 UniqID based syncing, first WIP state. 2012-08-23 17:38:44 +03:00
Klaas Freitag
76b09b3c14 Fix rename: Exclude directories and set mtimes accordingly. 2012-08-09 16:59:08 +03:00
Klaas Freitag
253605758e Use remote rename if local rename is detected. 2012-08-02 16:58:54 +03:00
Klaas Freitag
1104619a52 No atime on apple platform. 2012-07-19 21:11:35 +02:00
Klaas Freitag
b57f33353d fixed copy and paste errors in error output. 2012-07-19 21:06:18 +02:00
Klaas Freitag
cad3da10db Merge branch 'timedelta' into dav 2012-07-19 15:53:12 +02:00
Klaas Freitag
c0f1f36f59 Fix condition on when atomar push is allowed, never for local files. 2012-07-09 13:26:20 +02:00
Klaas Freitag
065529642e Ability to push to remote without using a tempfile to copy to.
Modules such as ownCloud make sure anyway that the upload to a
remote resource happens atomar. This patch allows to switch off
the default behaviour of first copying to a temp file in the
same directory. Use csync_set_remote_push_atomar function to
switch off.
2012-07-09 13:26:20 +02:00
Klaas Freitag
dc2148aa15 Removed a stat call that is just for a file size check. 2012-07-09 13:23:48 +02:00
Klaas Freitag
6eb4e707d9 Add module capability about if a post copy size check is required. 2012-07-04 15:03:15 +02:00
Klaas Freitag
8ba2f483bf Add a vio capabilites function to let a module define its capabilities. 2012-07-04 13:56:24 +02:00
Klaas Freitag
98bc5098c9 Merge branch 'dav' of ssh://milliways.cryptomilk.org/users/freitag/csync into dav
Conflicts:
	src/csync_propagate.c
2012-07-01 15:27:41 +02:00
Klaas Freitag
f31c74743c Fix condition on when atomar push is allowed, never for local files. 2012-06-26 18:30:50 +02:00
Klaas Freitag
8034da83cc Ability to push to remote without using a tempfile to copy to.
Modules such as ownCloud make sure anyway that the upload to a
remote resource happens atomar. This patch allows to switch off
the default behaviour of first copying to a temp file in the
same directory. Use csync_set_remote_push_atomar function to
switch off.
2012-06-26 18:30:50 +02:00
Klaas Freitag
55c3b0862c Zero'ed a stat call that is just for a file size check. 2012-06-26 18:20:16 +02:00
Klaas Freitag
357b5cd5f3 Ability to push to remote without using a tempfile to copy to.
Modules such as ownCloud make sure anyway that the upload to a
remote resource happens atomar. This patch allows to switch off
the default behaviour of first copying to a temp file in the
same directory. Use csync_set_remote_push_atomar function to
switch off.
2012-06-22 15:32:04 +02:00
Klaas Freitag
10c11cc5e8 Removed a stat call that is just for a file size check. 2012-04-14 03:13:27 +02:00
Klaas Freitag
a0e0caa5b8 Fix use of strerror_r on non GNU platforms. 2012-03-19 12:40:43 +01:00
Andreas Schneider
f0cf678c0e Fix config checks. 2012-03-02 17:04:02 +01:00
Andreas Schneider
331783baef propagate: Remove dead and wrong assignments. 2012-02-04 12:54:15 +01:00
Andreas Schneider
8e89bfec2b propagate: Fix dead assignment. 2012-02-04 12:47:39 +01:00
Andreas Schneider
9f802a83f3 propagate: Fix some blank lines. 2012-02-04 12:37:33 +01:00
Andreas Schneider
de2cb55f0e propagate: Remove unused variables. 2012-02-04 12:28:51 +01:00
Christian Jann
a8071bfd14 csync.propagator/csync.reconciler first print instruction type,
than print the path and align everything correctly (easier to read)
2011-04-12 17:06:18 +02:00
Christian Jann
aad3e146fc set instruction after conflict backup for the statedb merger to NONE 2011-04-12 10:09:41 +02:00
Christian Jann
d842119065 improved logging 2011-04-06 17:07:20 +02:00
Christian Jann
e4d8e793f6 added new conflict resolution to libcsync
- use the latest version of the two files under its original filename
  in both destinations (same as currently implemented)
- additionally, create a copy of the older file under a different name
  using the same file extension with appended marker (e.g. "conflict")
  and timestamp in both destinations
  (e.g. textfile.odt -> textfile_conflict-20100222-105000.odt)
- At the Moment 'textfile_conflict-20100222-105000.odt' is only created
  on the side where the conflict has occurred and gets synced to the other side
  on the second sync.
2011-04-06 16:57:24 +02:00
Andreas Schneider
fdea54edc5 Fix the vim modlines. 2009-05-13 10:12:07 +02:00
Andreas Schneider
e69976bc88 Fix a bug where the wrong function for deletion was executed.
Thanks to David Wooldridge for all the testing.
2009-01-23 14:07:34 +01:00
Andreas Schneider
1047431e4c Fix a typo. 2008-12-13 23:29:16 +01:00
Andreas Schneider
3b51103a60 Implement own function to create a random filename.
This removes an uneeded syscall to lstat by mktemp at this point.
2008-11-13 15:11:02 +01:00
Andreas Schneider
0681db0efe Reduce system calls of getuid and geteuid. 2008-11-13 14:08:26 +01:00
Andreas Schneider
1e70c74037 Set the replica to destination only once. 2008-11-13 14:06:22 +01:00
Andreas Schneider
17b39a78c1 Fix open and use the flags variable. 2008-11-12 21:14:35 +01:00
Andreas Schneider
1b4e340565 Fix compiler warnings. 2008-09-11 14:16:04 +02:00
Andreas Schneider
e25422ba3f Fix the formating not be be longer than 80 chars. 2008-09-05 13:28:30 +02:00
Andreas Schneider
971e3301e3 Add some comments. 2008-09-02 11:43:29 +02:00
Andreas Schneider
6d3a7d84c1 Fix flags for the statedb tree merger. 2008-09-02 11:42:34 +02:00
Andreas Schneider
33681552c7 Remove useless error message. 2008-08-22 15:27:27 +02:00
Andreas Schneider
ebfbcf18a5 Handle no space left on device. 2008-08-22 15:26:02 +02:00
Andreas Schneider
8451d29d12 Replace strerror with thread safe version. 2008-07-18 11:35:02 +02:00
Andreas Schneider
e5286c7c8a Rename journal functions to statedb. 2008-07-09 10:10:00 +02:00
Andreas Schneider
dc964a4c9a Only run chmod if we are root. 2008-07-03 11:34:34 +02:00
Andreas Schneider
70ca880a05 Set the right instruction during propagation for the journal. 2008-06-28 17:18:10 +02:00
Andreas Schneider
259319f4f9 Stop synchronization if quota exceeded. 2008-06-28 15:33:52 +02:00
Andreas Schneider
5d35a46d07 More printf fixes. 2008-06-27 19:05:54 +02:00
Andreas Schneider
bd8034170a Fix printf attributes. 2008-06-27 18:52:09 +02:00
Andreas Schneider
e9cfa4e610 Remove accidently commited debug message. 2008-06-27 16:12:26 +02:00
Andreas Schneider
bcbf4f02f5 Fix debug output and add more output. 2008-06-25 13:43:47 +02:00
Andreas Schneider
e795539137 Create files and directories with a default mode again and run chmod.
The chmod function is only called if the file we synchronize has a
different mode set.
2008-06-24 18:02:00 +02:00
Andreas Schneider
75c22fce6c Improve debug and error messages. 2008-06-24 18:01:43 +02:00
Andreas Schneider
aee15d55ee Improve debug message. 2008-06-24 13:34:27 +02:00
Andreas Schneider
902b588d60 Close the files after copy. 2008-06-18 16:30:00 +02:00
Andreas Schneider
8f427a8ccb Set instruction to UPDATED for newly created files.
This is needed that csync knows which file stats need to be updated. We
need the new inode number for the journal.
2008-06-18 10:44:40 +02:00
Andreas Schneider
7935d63098 Don't add deleted files to the journal. 2008-06-18 09:56:08 +02:00
Andreas Schneider
4246190524 Set O_NOATIME if we are the owner of the file or a superuser. 2008-06-16 17:49:45 +02:00
Andreas Schneider
8a9a4b18fb Improve debug output if open fails. 2008-06-16 16:42:46 +02:00
Andreas Schneider
0eb0842e0a Fix return code of open which was always 1. 2008-06-16 16:41:19 +02:00
Andreas Schneider
9c9faebd0e Fix open on the original file in propagation.
O_NOATIME can only be set by the owner of the file or root.
2008-06-16 16:40:25 +02:00
Andreas Schneider
bac6f7d7b6 Set the right owner and group if possible. 2008-06-09 17:16:44 +02:00
Andreas Schneider
971e85871a Move count var to the function stack and add O_NOCTTY to open(). 2008-06-09 16:44:49 +02:00
Andreas Schneider
7f003c1277 Make sure that we can't run in an infinite loop. 2008-06-06 13:23:42 +02:00
Andreas Schneider
4adb536048 Create the missing directory only in the error case. 2008-06-06 10:28:53 +02:00
Andreas Schneider
212defd763 Create a new temporary file name if the file already exists. 2008-06-06 10:28:44 +02:00
Andreas Schneider
e756830696 Use open and fail if the file already exists. 2008-06-06 10:17:58 +02:00
Andreas Schneider
0e499d0b30 Remove the temporary file if an error occurs. 2008-06-06 10:17:37 +02:00
Andreas Schneider
aec3f4440c Use a random generated temporary file name. 2008-06-06 10:15:58 +02:00
Andreas Schneider
1255c46668 Add some FIXME's. 2008-06-05 14:44:14 +02:00
Andreas Schneider
ed3073ba13 Move the chmod command before we call utimes. 2008-06-05 14:43:28 +02:00
Andreas Schneider
13f82f25ff Set the right mode during open.
This gives us a speedup about 60 seconds copying the linux kernel sources.
2008-06-05 13:32:23 +02:00
Andreas Schneider
34e59bae46 We shouldn't follow symlinks and don't change the access time.
This gives a small speedup of the read command.
2008-06-05 13:31:23 +02:00
Andreas Schneider
e5180d19d4 Only create paths when needed. 2008-06-05 12:02:37 +02:00
Andreas Schneider
364a9015d3 Improve the speed of the push_file function.
The stat() calls in mkdirs() slows down the execution of this
function. Now we spend the most time for asprintf().
2008-06-04 18:19:14 +02:00
Andreas Schneider
7921b88467 Don't output on error if we remove a dir and errno is ENOTEMPTY. 2008-05-27 13:51:58 +02:00
Andreas Schneider
d5aced82ca Disable sync of symlinks cause they need a lot of work. 2008-05-26 17:09:42 +02:00
Andreas Schneider
66fd0e2de0 Add basic support for symbolic links.
A test to ensure that it is working is still needed.
2008-05-26 15:58:40 +02:00
Andreas Schneider
49e10b7e6a Add debug message if mkdirs fails. 2008-05-21 15:50:27 +02:00
Andreas Schneider
5a77997d55 Rename static functions to start with an underscore. 2008-05-20 14:01:04 +02:00
Andreas Schneider
235b817de0 Add a directory cleanup function to the propagator. 2008-05-20 13:56:43 +02:00
Andreas Schneider
1712447252 Check return values and errno of functions. 2008-05-19 16:29:01 +02:00
Andreas Schneider
c01d75d026 Split up the propagation visitor in file and dir propagator. 2008-05-19 11:39:11 +02:00
Andreas Schneider
d3f8e4aa7d Add more functions to the propagation visitor. 2008-05-19 11:30:41 +02:00
Andreas Schneider
c325f7d5e1 Add new file to propagator. 2008-05-19 11:21:44 +02:00
Andreas Schneider
702265920f Fix csync_push_file. 2008-05-19 11:20:46 +02:00
Andreas Schneider
432c87b335 Fix typo use mkdirs. 2008-05-19 11:20:08 +02:00
Andreas Schneider
e2bc2031cd Improve error messages. 2008-05-19 11:19:31 +02:00
Andreas Schneider
d68ac512e0 Fix warning and initialize the replica values. 2008-05-19 11:16:51 +02:00
Andreas Schneider
0be9a1e02b Add reconciler.
Currently only new directories are created. Other functions are prepared
bug not tested yet.
2008-05-16 17:30:57 +02:00