samba-bugs@samba.org
2004-Sep-15 06:41 UTC
[Bug 1764] New: dry-run does not show changes in owner / group, permission, or timestamp
https://bugzilla.samba.org/show_bug.cgi?id=1764 Summary: dry-run does not show changes in owner / group, permission, or timestamp Product: rsync Version: 2.6.3 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P3 Component: core AssignedTo: wayned@samba.org ReportedBy: mwang@unixlabplus.com QAContact: rsync-qa@samba.org 1. Test case: # touch a b # chmod 777 a; chmod 000 b # ./rsync -vanx a b building file list ... done wrote 54 bytes read 20 bytes 148.00 bytes/sec total size is 0 speedup is 0.00 /* Please note the b does not show up. * Without -n option and with addition -v option (-vv), b does show up. * * The patch provides below does: * (1) with "-n" option, b shows up. * (2) without "-n" option and with only "-v" option b show up as well. * I consider (1) as a bug fix; and (2) makes the rsync behavior more close * to what documented in man page, as attributes are part of a file. * / -v, --verbose This option increases the amount of information you are given during the transfer. By default, rsync works silently. A single -v will give you information about what files are being transferred and a brief summary at the end. Two -v flags will give you information on what files are being skipped and slightly more information at the end. More than two -v flags should only be used if you are debugging rsync. # ./rsync_patched -vanx a b building file list ... done chmod: b wrote 54 bytes read 20 bytes 49.33 bytes/sec total size is 0 speedup is 0.00 2. Patch --- rsync-2.6.2/rsync.c Tue Mar 23 11:16:15 2004 +++ rsync-2.6.2-new/rsync.c Wed Sep 15 01:35:16 2004 @@ -129,7 +129,6 @@ STRUCT_STAT st2; int change_uid, change_gid; - if (dry_run) return 0; if (!st) { if (link_stat(fname,&st2) != 0) { @@ -142,6 +141,10 @@ if (preserve_times && !S_ISLNK(st->st_mode) && cmp_modtime(st->st_mtime, file->modtime) != 0) { + if (dry_run) { + rprintf(FINFO,"modtime: %s\n",fname); + return 0; + } /* don't complain about not setting times on directories * because some filesystems can't do it */ if (set_modtime(fname,file->modtime) != 0 && @@ -157,6 +160,10 @@ change_gid = preserve_gid && file->gid != GID_NONE && st->st_gid != file->gid; if (change_uid || change_gid) { + if (dry_run) { + rprintf(FINFO,"chown: %s\n",fname); + return 0; + } if (verbose > 2) { if (change_uid) { rprintf(FINFO, @@ -191,6 +198,10 @@ #ifdef HAVE_CHMOD if (!S_ISLNK(st->st_mode)) { if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) { + if (dry_run) { + rprintf(FINFO,"chmod: %s\n",fname); + return 0; + } updated = 1; if (do_chmod(fname,(file->mode & CHMOD_BITS)) != 0) { rprintf(FERROR, "failed to set permissions on %s : %s\n", @@ -201,7 +212,7 @@ } #endif - if (verbose > 1 && report) { + if (verbose >= 1 && report) { if (updated) rprintf(FINFO,"%s\n",fname); else -- Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug, or are watching the QA contact.