"-b --suffix '' --delete --backup-dir /path/" combination does
not act as expected
jw schultz
jw at pegasys.ws
Fri Aug 1 12:16:40 EST 2003
On Thu, Jul 31, 2003 at 06:28:46PM -0700, Wayne Davison wrote:
> On Thu, Jul 31, 2003 at 01:37:59PM -0700, jw schultz wrote:
> > Have at it!
>
> OK, here's what I came up with:
>
> http://www.blorf.net/rsync-backup.patch
I took a cursory look, as you log probably shows. Seems
mostly OK. I mostly like the simplification in options.c
My only concern is that i don't like depending on
strcmp(backup_suffix, BACKUP_SUFFIX). I'd rather test
backup_suffix for NULL that way behaviour will be consistent.
--backup
uses suffix of ~ unless backup-dir or
suffix specified
--backup-dir
no suffix unless --suffix
--suffix=~ --backup-dir
files in backup-dir will have ~ suffix
That means either a specified_suffix to overide
backup_suffix with a test when we create backup_dir
or some backup_suffix uses would be
(backup_suffix ? backup_suffix : BACKUP_SUFFIX)
> This simplifies things in options.c to avoid the suffix_specified
> weirdness, sets a couple len variables to avoid calling strlen()
> neelessly, and fixes the problem where deleted files could get
> removed instead of backed up. I also noticed that a removed file
> did not get mentioned in the -v output if it got renamed to a backup
> file. This seems wrong to me, so I made it mention the file as a
> deletion, even though it is being backed up. What do folks think?
> Should it instead output "renaming" intead of "deleting"?
You are right. In the last few months we had a complaint
that deleted files weren't reported when being backed up.
"renaming" is too likely to be confused by some as
file-rename recognition. I don't expect the current
codebase to ever have that feature but no point causing
confusion. I don't care for "deleting" here either for
similar reasons. How about "backing-up"?
Also the message should be moved into make_backup()
and the message shouldn't be printed until after the backup
is complete. Perhaps just:
--- backup.c Thu Jul 31 02:17:07 2003
+++ backup.c.new Thu Jul 31 19:15:01 2003
@@ -47,8 +47,8 @@
rsyserr(FERROR, errno, "rename %s to backup %s", fname, fnamebak);
return 0;
}
- } else if (verbose > 1) {
- rprintf(FINFO, "backed up %s to %s\n", fname, fnamebak);
+ } else if (verbose) {
+ rprintf(FINFO, "backing up %s to %s\n", fname, fnamebak);
}
return 1;
}
@@ -289,8 +289,8 @@
free_file (file);
free (file);
- if (verbose > 1)
- rprintf (FINFO, "keep_backup %s -> %s\n", fname, keep_name);
+ if (verbose)
+ rprintf (FINFO, "backing up %s to %s\n", fname, keep_name);
return 1;
} /* keep_backup */
--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync
mailing list