Skip to content

Commit

Permalink
Disable sync of symlinks cause they need a lot of work.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptomilk committed May 26, 2008
1 parent 66fd0e2 commit d5aced8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
6 changes: 6 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* Add support to synchronize symbolic links
- This needs a lot of work cause we have to check the symlink
+ Determine if a symlink points outside the current directory tree. They
are unsafe to sync.
+ Null symlinks and absolute symlinks are always unsafe.
- Check which is the best way to sync symlinks
4 changes: 4 additions & 0 deletions config/csync.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ max_time_difference = 10

# max directory depth recursion
max_depth = 50

# NOT IN USE:
# sync symbolic links if the remote filesystem supports it.
#sync_symbolic_links = false
1 change: 1 addition & 0 deletions src/csync_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct csync_s {

enum csync_ftw_type_e {
CSYNC_FTW_TYPE_FILE,
CSYNC_FTW_TYPE_SLINK,
CSYNC_FTW_TYPE_DIR
};

Expand Down
5 changes: 5 additions & 0 deletions src/csync_propagate.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ static int _csync_propagation_file_visitor(void *obj, void *data) {
ctx = (CSYNC *) data;

switch(st->type) {
case CSYNC_FTW_TYPE_SLINK:
break;
case CSYNC_FTW_TYPE_FILE:
switch (st->instruction) {
case CSYNC_INSTRUCTION_NEW:
Expand Down Expand Up @@ -583,6 +585,9 @@ static int _csync_propagation_dir_visitor(void *obj, void *data) {
ctx = (CSYNC *) data;

switch(st->type) {
case CSYNC_FTW_TYPE_SLINK:
/* FIXME: implement symlink support */
break;
case CSYNC_FTW_TYPE_FILE:
break;
case CSYNC_FTW_TYPE_DIR:
Expand Down
28 changes: 12 additions & 16 deletions src/csync_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,20 @@ static int csync_detect_update(CSYNC *ctx, const char *file, const csync_vio_fil
int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs, enum csync_ftw_flags_e flag) {
switch (flag) {
case CSYNC_FTW_FLAG_FILE:
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s", file);

return csync_detect_update(ctx, file, fs, CSYNC_FTW_TYPE_FILE);
break;
case CSYNC_FTW_FLAG_SLINK:
switch (fs->mode & S_IFMT) {
case S_IFREG:
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s", file);

return csync_detect_update(ctx, file, fs, CSYNC_FTW_TYPE_FILE);
break;
case S_IFLNK:
/* TODO: check if plugin supports symlinks */
if (ctx->options.sync_symbolic_links) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "symlink: %s", file);

return csync_detect_update(ctx, file, fs, CSYNC_FTW_TYPE_FILE);
}
break;
default:
break;
/* FIXME: implement support for symlinks, see csync_propagate.c too */
#if 0
if (ctx->options.sync_symbolic_links) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "symlink: %s", file);

return csync_detect_update(ctx, file, fs, CSYNC_FTW_TYPE_SLINK);
}
#endif
break;
case CSYNC_FTW_FLAG_DIR: /* enter directory */
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "directory: %s", file);

Expand Down

0 comments on commit d5aced8

Please sign in to comment.