[SCM] The rsync repository. - branch master updated
The branch, master has been updated via 6df5d81 Fix a few issues with make_path(). from 0e3152f Change owner+group before setting xattrs to avoid xattr loss. Fixes bug 10163. ;a=shortlog;h=master - Log - commit 6df5d81ce2a0df0c83aae0a0f31e9703a50b271e Author: Wayne Davison Date: Mon Dec 23 10:27:24 2013 -0800 Fix a few issues with make_path(). The make_path() utility function was not returning the right status when --dry-run was used, so I added some stat() checking that only happens for -n. I also noticed that the function was not handling the case where the whole path needed to be created, so I fixed that. Fixes bug 10209. --- Summary of changes: util.c | 22 ++ 1 files changed, 18 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/util.c b/util.c index c943ce0..aeb5217 100644 --- a/util.c +++ b/util.c @@ -25,6 +25,7 @@ #include "itypes.h" #include "inums.h" +extern int dry_run; extern int module_id; extern int protect_args; extern int modify_window; @@ -197,7 +198,15 @@ int make_path(char *fname, int flags) /* Try to find an existing dir, starting from the deepest dir. */ for (p = end; ; ) { - if (do_mkdir(fname, ACCESSPERMS) == 0) { + if (dry_run) { + STRUCT_STAT st; + if (do_stat(fname, &st) == 0) { + if (S_ISDIR(st.st_mode)) + errno = EEXIST; + else + errno = ENOTDIR; + } + } else if (do_mkdir(fname, ACCESSPERMS) == 0) { ret++; break; } @@ -208,12 +217,14 @@ int make_path(char *fname, int flags) } while (1) { if (p == fname) { - ret = -ret - 1; + /* We got a relative path that doesn't exist, so assume that '.' +* is there and just break out and create the whole thing. */ + p = NULL; goto double_break; } if (*--p == '/') { if (p == fname) { - ret = -ret - 1; /* impossible... */ + /* We reached the "/" dir, which we assume is there. */ goto double_break; } *p = '\0'; @@ -225,7 +236,10 @@ int make_path(char *fname, int flags) /* Make all the dirs that we didn't find on the way here. */ while (p != end) { - *p = '/'; + if (p) + *p = '/'; + else + p = fname; p += strlen(p); if (ret < 0) /* Skip mkdir on error, but keep restoring the path. */ continue; -- The rsync repository. ___ rsync-cvs mailing list rsync-cvs@lists.samba.org https://lists.samba.org/mailman/listinfo/rsync-cvs
[SCM] The rsync repository. - branch master updated
The branch, master has been updated via 0e3152f Change owner+group before setting xattrs to avoid xattr loss. Fixes bug 10163. from e9398b1 Fix a typo that Stefan Beller pointed out. ;a=shortlog;h=master - Log - commit 0e3152febdaf5b14bb4d3597a5fc8256d61ce3f2 Author: Wayne Davison Date: Mon Dec 23 09:49:17 2013 -0800 Change owner+group before setting xattrs to avoid xattr loss. Fixes bug 10163. --- Summary of changes: rsync.c | 50 +- 1 files changed, 25 insertions(+), 25 deletions(-) Changeset truncated at 500 lines: diff --git a/rsync.c b/rsync.c index 1f9b029..131faa1 100644 --- a/rsync.c +++ b/rsync.c @@ -489,31 +489,6 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, get_acl(fname, sxp); #endif -#ifdef SUPPORT_XATTRS - if (am_root < 0) - set_stat_xattr(fname, file, new_mode); - if (preserve_xattrs && fnamecmp) - set_xattr(fname, file, fnamecmp, sxp); -#endif - - if (!preserve_times -|| (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode)) -|| (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode))) - flags |= ATTRS_SKIP_MTIME; - if (!(flags & ATTRS_SKIP_MTIME) - && cmp_time(sxp->st.st_mtime, file->modtime) != 0) { - int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode); - if (ret < 0) { - rsyserr(FERROR_XFER, errno, "failed to set times on %s", - full_fname(fname)); - goto cleanup; - } - if (ret == 0) /* ret == 1 if symlink could not be set */ - updated = 1; - else - file->flags |= FLAG_TIME_FAILED; - } - change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file); change_gid = gid_ndx && !(file->flags & FLAG_SKIP_GROUP) && sxp->st.st_gid != (gid_t)F_GROUP(file); @@ -561,6 +536,31 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, updated = 1; } +#ifdef SUPPORT_XATTRS + if (am_root < 0) + set_stat_xattr(fname, file, new_mode); + if (preserve_xattrs && fnamecmp) + set_xattr(fname, file, fnamecmp, sxp); +#endif + + if (!preserve_times +|| (!(preserve_times & PRESERVE_DIR_TIMES) && S_ISDIR(sxp->st.st_mode)) +|| (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode))) + flags |= ATTRS_SKIP_MTIME; + if (!(flags & ATTRS_SKIP_MTIME) + && cmp_time(sxp->st.st_mtime, file->modtime) != 0) { + int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode); + if (ret < 0) { + rsyserr(FERROR_XFER, errno, "failed to set times on %s", + full_fname(fname)); + goto cleanup; + } + if (ret == 0) /* ret == 1 if symlink could not be set */ + updated = 1; + else + file->flags |= FLAG_TIME_FAILED; + } + #ifdef SUPPORT_ACLS /* It's OK to call set_acl() now, even for a dir, as the generator * will enable owner-writability using chmod, if necessary. -- The rsync repository. ___ rsync-cvs mailing list rsync-cvs@lists.samba.org https://lists.samba.org/mailman/listinfo/rsync-cvs
CVS update: rsyncweb
Date: Mon Dec 23 17:31:25 2013 Author: wayned Update of /data/cvs/rsyncweb In directory fn.samba.org:/tmp/cvs-serv308790 Modified Files: issues.html Log Message: Tweak strace suggestion; get rid of really old issue. Revisions: issues.html 1.27 => 1.28 http://www.samba.org/cgi-bin/cvsweb/rsyncweb/issues.html?r1=1.27&r2=1.28 ___ rsync-cvs mailing list rsync-cvs@lists.samba.org https://lists.samba.org/mailman/listinfo/rsync-cvs
CVS update: rsyncweb
Date: Mon Dec 23 17:26:33 2013 Author: wayned Update of /data/cvs/rsyncweb In directory fn.samba.org:/tmp/cvs-serv307038 Modified Files: rsync-debug Log Message: Add a couple more strace options. Revisions: rsync-debug 1.4 => 1.5 http://www.samba.org/cgi-bin/cvsweb/rsyncweb/rsync-debug?r1=1.4&r2=1.5 ___ rsync-cvs mailing list rsync-cvs@lists.samba.org https://lists.samba.org/mailman/listinfo/rsync-cvs