Compare commits

...

13 Commits

Author SHA1 Message Date
rsync-bugs
3d8810c928 preparing for release of 2.4.6 2000-09-06 02:47:00 +00:00
Andrew Tridgell
d153974ee2 README update 2000-09-06 02:39:45 +00:00
Andrew Tridgell
5b56cc19fb added --modify-window option from David Bolen <db3l@fitlinxx.com> 2000-09-06 02:12:13 +00:00
Andrew Tridgell
c48b22c858 minor man page update 2000-09-06 01:27:46 +00:00
Andrew Tridgell
65d0a49f5c removed spurious error message 2000-09-06 00:48:52 +00:00
Andrew Tridgell
6a48ca56eb added LFS support for Solaris 8 2000-09-05 23:21:27 +00:00
Andrew Tridgell
a20aa42ac4 a simple fix to the memory problems with the string pool patch. The
string pools conflict with the lastdir memory saving tricks.
2000-08-31 23:01:28 +00:00
Andrew Tridgell
e92ee12893 make sure we don't chew too much CPU when the outgoing fd is full 2000-08-29 05:07:08 +00:00
Andrew Tridgell
5c66303ad6 some string_area cleanups 2000-08-29 04:47:39 +00:00
Andrew Tridgell
27e3e9c906 detect list_only a bit earlier 2000-08-29 04:46:50 +00:00
Andrew Tridgell
f0b36a48c8 the 2nd half of the hack 2000-08-29 04:46:27 +00:00
Andrew Tridgell
25cf88936f a hack to make listing remote sites (by leaving off a target) more
useful
2000-08-29 04:45:49 +00:00
Andrew Tridgell
ae682c3e11 got rid of some unused variables 2000-08-19 15:25:05 +00:00
18 changed files with 129 additions and 53 deletions

View File

@@ -9,6 +9,7 @@ mandir=@mandir@
LIBS=@LIBS@
CC=@CC@
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
INSTALLCMD=@INSTALL@

3
README
View File

@@ -125,8 +125,7 @@ There is a mailing list for the discussion of rsync and its
applications. It is open to anyone to join. I will announce new
versions on this list.
To join the mailing list send mail to listproc@samba.org with
no subject and a body of "subscribe rsync Your Name".
To join the mailing list see the web page at http://lists.samba.org/
To send mail to everyone on the list send it to rsync@samba.org

View File

@@ -135,7 +135,6 @@ static int get_secret(int module, char *user, char *secret, int len)
static char *getpassf(char *filename)
{
char buffer[100];
int len=0;
int fd=0;
STRUCT_STAT st;
int ok = 1;
@@ -170,7 +169,7 @@ static char *getpassf(char *filename)
if (envpw) rprintf(FERROR,"RSYNC_PASSWORD environment variable ignored\n");
buffer[sizeof(buffer)-1]='\0';
if ( (len=read(fd,buffer,sizeof(buffer)-1)) > 0)
if (read(fd,buffer,sizeof(buffer)-1) > 0)
{
char *p = strtok(buffer,"\n\r");
close(fd);

View File

@@ -38,6 +38,11 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
extern int am_sender;
extern struct in_addr socket_address;
if (argc == 0 && !am_sender) {
extern int list_only;
list_only = 1;
}
if (*path == '/') {
rprintf(FERROR,"ERROR: The remote path must start with a module name\n");
return -1;

View File

@@ -4,15 +4,24 @@ AC_CONFIG_HEADER(config.h)
# compile with optimisation and without debugging by default
CFLAGS=${CFLAGS-"-O"}
LDFLAGS=${LDFLAGS-""}
AC_CANONICAL_SYSTEM
AC_VALIDATE_CACHE_SYSTEM_TYPE
# look for getconf early as this affects just about everything
AC_CHECK_PROG(HAVE_GETCONF, getconf, 1, 0)
if test $HAVE_GETCONF = 1; then
CFLAGS=$CFLAGS" "`getconf LFS_CFLAGS`
LDFLAGS=$LDFLAGS" "`getconf LFS_LDFLAGS`
fi
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_SUBST(SHELL)
AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH)

View File

@@ -222,6 +222,12 @@ void send_exclude_list(int f)
{
int i;
extern int remote_version;
extern int list_only, recurse;
/* this is a complete hack - blame Rusty */
if (list_only && !recurse) {
add_exclude("/*/*", 0);
}
if (!exclude_list) {
write_int(f,0);

16
flist.c
View File

@@ -55,7 +55,7 @@ static struct file_struct null_file;
static void clean_flist(struct file_list *flist, int strip_root);
struct string_area *string_area_new(int size)
static struct string_area *string_area_new(int size)
{
struct string_area *a;
@@ -65,12 +65,12 @@ struct string_area *string_area_new(int size)
a->current = a->base = malloc(size);
if (!a->current) out_of_memory("string_area_new buffer");
a->end = a->base + size;
a->next = 0;
a->next = NULL;
return a;
}
void string_area_free(struct string_area *a)
static void string_area_free(struct string_area *a)
{
struct string_area *next;
@@ -80,7 +80,7 @@ void string_area_free(struct string_area *a)
}
}
char *string_area_malloc(struct string_area **ap, int size)
static char *string_area_malloc(struct string_area **ap, int size)
{
char *p;
struct string_area *a;
@@ -100,7 +100,7 @@ char *string_area_malloc(struct string_area **ap, int size)
return p;
}
char *string_area_strdup(struct string_area **ap, const char *src)
static char *string_area_strdup(struct string_area **ap, const char *src)
{
char* dest = string_area_malloc(ap, strlen(src) + 1);
return strcpy(dest, src);
@@ -534,7 +534,7 @@ struct file_struct *make_file(int f, char *fname, struct string_area **ap,
if (lastdir && strcmp(fname, lastdir)==0) {
file->dirname = lastdir;
} else {
file->dirname = STRDUP(ap, fname);
file->dirname = strdup(fname);
lastdir = file->dirname;
}
file->basename = STRDUP(ap, p+1);
@@ -579,7 +579,7 @@ struct file_struct *make_file(int f, char *fname, struct string_area **ap,
if (lastdir && strcmp(lastdir, flist_dir)==0) {
file->basedir = lastdir;
} else {
file->basedir = STRDUP(ap, flist_dir);
file->basedir = strdup(flist_dir);
lastdir = file->basedir;
}
} else {
@@ -1015,7 +1015,7 @@ struct file_list *flist_new()
#if ARENA_SIZE > 0
flist->string_area = string_area_new(0);
#else
flist->string_area = 0;
flist->string_area = NULL;
#endif
return flist;
}

View File

@@ -35,6 +35,7 @@ extern int size_only;
extern int io_timeout;
extern int remote_version;
extern int always_checksum;
extern int modify_window;
extern char *compare_dest;
@@ -75,7 +76,7 @@ static int skip_file(char *fname,
return 0;
}
return (st->st_mtime == file->modtime);
return (cmp_modtime(st->st_mtime,file->modtime) == 0);
}
@@ -343,7 +344,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
return;
}
if (update_only && st.st_mtime > file->modtime && fnamecmp == fname) {
if (update_only && cmp_modtime(st.st_mtime,file->modtime)>0 && fnamecmp == fname) {
if (verbose > 1)
rprintf(FINFO,"%s is newer\n",fname);
return;

29
io.c
View File

@@ -39,16 +39,10 @@ extern int verbose;
extern int io_timeout;
extern struct stats stats;
static int buffer_f_in = -1;
static int io_error_fd = -1;
static void read_loop(int fd, char *buf, int len);
void setup_readbuffer(int f_in)
{
buffer_f_in = f_in;
}
static void check_timeout(void)
{
extern int am_server, am_daemon;
@@ -323,11 +317,7 @@ unsigned char read_byte(int f)
return c;
}
/* write len bytes to fd, possibly reading from buffer_f_in if set
in order to unclog the pipe. don't return until all len
bytes have been written */
/* write len bytes to fd */
static void writefd_unbuffered(int fd,char *buf,int len)
{
int total = 0;
@@ -382,6 +372,7 @@ static void writefd_unbuffered(int fd,char *buf,int len)
if (ret == -1 &&
(errno == EWOULDBLOCK || errno == EAGAIN)) {
msleep(1);
continue;
}
@@ -473,6 +464,17 @@ void io_end_buffering(int fd)
}
}
/* some OSes have a bug where an exit causes the pending writes on
a socket to be flushed. Do an explicit shutdown to try to prevent this */
void io_shutdown(void)
{
if (multiplex_out_fd != -1) close(multiplex_out_fd);
if (io_error_fd != -1) close(io_error_fd);
multiplex_out_fd = -1;
io_error_fd = -1;
}
static void writefd(int fd,char *buf,int len)
{
stats.total_written += len;
@@ -623,8 +625,3 @@ void io_multiplexing_close(void)
io_multiplexing_out = 0;
}
void io_close_input(int fd)
{
buffer_f_in = -1;
}

View File

@@ -77,8 +77,6 @@ struct parm_struct
unsigned flags;
};
static BOOL bLoaded = False;
#ifndef GLOBAL_NAME
#define GLOBAL_NAME "global"
#endif
@@ -734,8 +732,6 @@ BOOL lp_load(char *pszFname, int globals_only)
iServiceIndex = -1;
bRetval = pm_process(n2, globals_only?NULL:do_section, do_parameter);
bLoaded = True;
return (bRetval);
}

16
main.c
View File

@@ -349,14 +349,13 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
close(recv_pipe[1]);
io_flush();
/* finally we go to sleep until our parent kills us
with a USR2 signal. We sleepp for a short time as on
with a USR2 signal. We sleep for a short time as on
some OSes a signal won't interrupt a sleep! */
while (1) sleep(1);
while (1) msleep(20);
}
close(recv_pipe[1]);
close(error_pipe[1]);
io_close_input(f_in);
if (f_in != f_out) close(f_in);
io_start_buffering(f_out);
@@ -465,7 +464,6 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
int status = 0, status2 = 0;
char *local_name = NULL;
extern int am_sender;
extern int list_only;
extern int remote_version;
set_nonblocking(f_in);
@@ -503,7 +501,10 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
exit_cleanup(status);
}
if (argc == 0) list_only = 1;
if (argc == 0) {
extern int list_only;
list_only = 1;
}
send_exclude_list(f_out);
@@ -641,6 +642,11 @@ static int start_client(int argc, char *argv[])
usage(FERROR);
exit_cleanup(RERR_SYNTAX);
}
if (argc == 0 && !am_sender) {
extern int list_only;
list_only = 1;
}
pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path,&f_in,&f_out);

View File

@@ -67,6 +67,11 @@ int delete_after=0;
int only_existing=0;
int max_delete=0;
int ignore_errors=0;
#ifdef _WIN32
int modify_window=2;
#else
int modify_window=0;
#endif
int blocking_io=0;
char *backup_suffix = BACKUP_SUFFIX;
@@ -85,6 +90,9 @@ int quiet = 0;
int always_checksum = 0;
int list_only = 0;
static int modify_window_set;
struct in_addr socket_address = {INADDR_ANY};
void usage(enum logcode F)
@@ -144,6 +152,7 @@ void usage(enum logcode F)
rprintf(F," --timeout=TIME set IO timeout in seconds\n");
rprintf(F," -I, --ignore-times don't exclude files that match length and time\n");
rprintf(F," --size-only only use file size when determining if a file should be transferred\n");
rprintf(F," --modify-window=NUM Timestamp window (seconds) for file match (default=%d)\n",modify_window);
rprintf(F," -T --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," -P equivalent to --partial --progress\n");
@@ -178,7 +187,8 @@ enum {OPT_VERSION, OPT_SUFFIX, OPT_SENDER, OPT_SERVER, OPT_EXCLUDE,
OPT_COPY_UNSAFE_LINKS, OPT_SAFE_LINKS, OPT_COMPARE_DEST,
OPT_LOG_FORMAT, OPT_PASSWORD_FILE, OPT_SIZE_ONLY, OPT_ADDRESS,
OPT_DELETE_AFTER, OPT_EXISTING, OPT_MAX_DELETE, OPT_BACKUP_DIR,
OPT_IGNORE_ERRORS, OPT_BWLIMIT, OPT_BLOCKING_IO};
OPT_IGNORE_ERRORS, OPT_BWLIMIT, OPT_BLOCKING_IO,
OPT_MODIFY_WINDOW};
static char *short_options = "oblLWHpguDCtcahvqrRIxnSe:B:T:zP";
@@ -200,6 +210,7 @@ static struct option long_options[] = {
{"one-file-system",0, 0, 'x'},
{"ignore-times",0, 0, 'I'},
{"size-only", 0, 0, OPT_SIZE_ONLY},
{"modify-window",1, 0, OPT_MODIFY_WINDOW},
{"help", 0, 0, 'h'},
{"dry-run", 0, 0, 'n'},
{"sparse", 0, 0, 'S'},
@@ -331,6 +342,11 @@ int parse_arguments(int argc, char *argv[], int frommain)
size_only = 1;
break;
case OPT_MODIFY_WINDOW:
modify_window = atoi(optarg);
modify_window_set = 1;
break;
case 'x':
one_file_system=1;
break;
@@ -598,6 +614,7 @@ void server_options(char **args,int *argc)
static char bsize[30];
static char iotime[30];
static char mdelete[30];
static char mwindow[30];
static char bw[50];
int i, x;
@@ -611,6 +628,7 @@ void server_options(char **args,int *argc)
argstr[0] = '-';
for (i=0;i<verbose;i++)
argstr[x++] = 'v';
/* the -q option is intentionally left out */
if (make_backups)
argstr[x++] = 'b';
@@ -652,6 +670,14 @@ void server_options(char **args,int *argc)
argstr[x++] = 'S';
if (do_compression)
argstr[x++] = 'z';
/* this is a complete hack - blame Rusty
this is a hack to make the list_only (remote file list)
more useful */
if (list_only && !recurse)
argstr[x++] = 'r';
argstr[x] = 0;
if (x != 1) args[ac++] = argstr;
@@ -690,6 +716,12 @@ void server_options(char **args,int *argc)
if (size_only)
args[ac++] = "--size-only";
if (modify_window_set) {
slprintf(mwindow,sizeof(mwindow),"--modify-window=%d",
modify_window);
args[ac++] = mwindow;
}
if (keep_partial)
args[ac++] = "--partial";

View File

@@ -1,10 +1,10 @@
Summary: Program for efficient remote updates of files.
Name: rsync
Version: 2.4.5
Version: 2.4.6
Release: 1
Copyright: GPL
Group: Applications/Networking
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.4.5.tar.gz
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.4.6.tar.gz
URL: http://samba.anu.edu.au/rsync/
Packager: Andrew Tridgell <tridge@samba.anu.edu.au>
BuildRoot: /tmp/rsync

View File

@@ -43,7 +43,7 @@ void free_sums(struct sum_struct *s)
/*
* delete a file or directory. If force_delet is set then delete
* delete a file or directory. If force_delete is set then delete
* recursively
*/
int delete_file(char *fname)
@@ -62,7 +62,6 @@ int delete_file(char *fname)
ret = do_stat(fname, &st);
#endif
if (ret) {
rprintf(FERROR,"stat(%s) : %s\n", fname, strerror(errno));
return -1;
}
@@ -163,7 +162,7 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st,
}
if (preserve_times && !S_ISLNK(st->st_mode) &&
st->st_mtime != file->modtime) {
cmp_modtime(st->st_mtime, file->modtime) != 0) {
/* don't complain about not setting times on directories
because some filesystems can't do it */
if (set_modtime(fname,file->modtime) != 0 &&

View File

@@ -223,7 +223,7 @@ verb(
-r, --recursive recurse into directories
-R, --relative use relative path names
-b, --backup make backups (default ~ suffix)
--backup-dir=DIR put backups in the specified directory
--backup-dir make backups into this directory
--suffix=SUFFIX override backup suffix
-u, --update update only (don't overwrite newer files)
-l, --links preserve soft links
@@ -256,6 +256,7 @@ verb(
--timeout=TIME set IO timeout in seconds
-I, --ignore-times don't exclude files that match length and time
--size-only only use file size when determining if a file should be transferred
--modify-window=NUM Timestamp window (seconds) for file match (default=0)
-T --temp-dir=DIR create temporary files in directory DIR
--compare-dest=DIR also compare destination files relative to DIR
-P equivalent to --partial --progress
@@ -316,6 +317,13 @@ regardless of timestamp. This is useful when starting to use rsync
after using another mirroring system which may not preserve timestamps
exactly.
dit(bf(--modify-window)) When comparing two timestamps rsync treats
the timestamps as being equal if they are within the value of
modify_window. This is normally zero, but you may find it useful to
set this to a larger value in some situations. In particular, when
transferring to/from FAT filesystems which cannot represent times with
a 1 second resolution this option is useful.
dit(bf(-c, --checksum)) This forces the sender to checksum all files using
a 128-bit MD4 checksum before transfer. The checksum is then
explicitly checked on the receiver and any files of the same name
@@ -497,9 +505,9 @@ See the section on exclude patterns for information on the syntax of
this option.
dit(bf(--exclude-from=FILE)) This option is similar to the --exclude
option, but instead it adds all filenames listed in the file FILE to
the exclude list. Blank lines in FILE and lines starting with ';' or '#'
are ignored.
option, but instead it adds all exclude patterns listed in the file
FILE to the exclude list. Blank lines in FILE and lines starting with
';' or '#' are ignored.
dit(bf(--include=PATTERN)) This option tells rsync to not exclude the
specified pattern of filenames. This is useful as it allows you to

View File

@@ -97,8 +97,6 @@ void send_files(struct file_list *flist,int f_out,int f_in)
if (verbose > 2)
rprintf(FINFO,"send_files starting\n");
setup_readbuffer(f_in);
while (1) {
int offset=0;

22
util.c
View File

@@ -955,7 +955,27 @@ void msleep(int t)
}
#ifdef __INSURE__
/*******************************************************************
Determine if two file modification times are equivalent (either exact
or in the modification timestamp window established by --modify-window)
Returns 0 if the times should be treated as the same, 1 if the
first is later and -1 if the 2nd is later
*******************************************************************/
int cmp_modtime(time_t file1, time_t file2)
{
time_t diff;
extern int modify_window;
if (file2 > file1) {
if (file2 - file1 <= modify_window) return 0;
return -1;
}
if (file1 - file2 <= modify_window) return 0;
return 1;
}
#ifdef __INSURE__XX
#include <dlfcn.h>
/*******************************************************************

View File

@@ -1 +1 @@
#define VERSION "2.4.5"
#define VERSION "2.4.6"