diff -u -r --new-file --exclude=CVS rsync-2.0.14/clientserver.c rsync-2.0.15/clientserver.c --- rsync-2.0.14/clientserver.c Wed May 27 23:54:31 1998 +++ rsync-2.0.15/clientserver.c Sat May 30 12:08:30 1998 @@ -362,6 +362,11 @@ { extern char *config_file; + /* this ensures that we don't call getcwd after the chroot, + which doesn't work on platforms that use popen("pwd","r") + for getcwd */ + push_dir("/", 0); + if (is_a_socket(STDIN_FILENO)) { /* we are running via inetd */ return start_daemon(STDIN_FILENO); diff -u -r --new-file --exclude=CVS rsync-2.0.14/cvs.log rsync-2.0.15/cvs.log --- rsync-2.0.14/cvs.log Fri May 29 12:29:41 1998 +++ rsync-2.0.15/cvs.log Sat May 30 12:10:38 1998 @@ -5234,3 +5234,94 @@ Log Message: preparing for release of 2.0.14 + +**************************************** +Date: Saturday May 30, 1998 @ 0:36 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv15383 + +Modified Files: + clientserver.c flist.c main.c options.c proto.h rsync.yo + util.c +Log Message: +replaced chdir and getcwd calls with push_dir/pop_dir functions. These +are faster and don't cause problems in a chrooted environment on any +systems. + + + +**************************************** +Date: Saturday May 30, 1998 @ 12:02 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv13286 + +Modified Files: + io.c +Log Message: +make sure that io_flush() doesn't call writefd_unbuffered from within +a writefd_unbuffered call! + +this should fix the "decompressor lost sync" bug + + + +**************************************** +Date: Saturday May 30, 1998 @ 12:03 +Author: tridge + +Update of /data/cvs/rsync +In directory samba:/tmp/cvs-serv11851 + +Modified Files: + rsync.c +Log Message: +cosmetic fix. + +reset offset to 0 at the start of each loop so the filenames get +printed correctly when sending directories followed by local names. + + + +**************************************** +Date: Saturday May 30, 1998 @ 12:07 +Author: tridge + +Update of /data/cvs/rsync/zlib +In directory samba:/tmp/cvs-serv25515 + +Modified Files: + infblock.c inflate.c infutil.h +Log Message: +replace BAD with zBAD so it compiles on AIX + + + +**************************************** +Date: Saturday May 30, 1998 @ 12:10 +Author: rsync-bu + +Update of /data/cvs/rsync +In directory samba:/data/people/rsync-bugs/rsync + +Modified Files: + version.h +Log Message: +preparing for release of 2.0.15 + + +**************************************** +Date: Saturday May 30, 1998 @ 12:10 +Author: rsync-bu + +Update of /data/cvs/rsync/packaging/redhat/5.0 +In directory samba:/data/people/rsync-bugs/rsync/packaging/redhat/5.0 + +Modified Files: + rsync.spec +Log Message: +preparing for release of 2.0.15 + diff -u -r --new-file --exclude=CVS rsync-2.0.14/flist.c rsync-2.0.15/flist.c --- rsync-2.0.14/flist.c Fri May 29 12:29:12 1998 +++ rsync-2.0.15/flist.c Sat May 30 12:08:30 1998 @@ -90,49 +90,6 @@ static char *flist_dir; -static void clean_fname(char *name) -{ - char *p; - int l; - int modified = 1; - - if (!name) return; - - while (modified) { - modified = 0; - - if ((p=strstr(name,"/./"))) { - modified = 1; - while (*p) { - p[0] = p[2]; - p++; - } - } - - if ((p=strstr(name,"//"))) { - modified = 1; - while (*p) { - p[0] = p[1]; - p++; - } - } - - if (strncmp(p=name,"./",2) == 0) { - modified = 1; - do { - p[0] = p[2]; - } while (*p++); - } - - l = strlen(p=name); - if (l > 1 && p[l-1] == '/') { - modified = 1; - p[l-1] = 0; - } - } -} - - void send_file_entry(struct file_struct *file,int f,unsigned base_flags) { @@ -566,7 +523,6 @@ int i,l; STRUCT_STAT st; char *p,*dir; - char dbuf[MAXPATHLEN]; char lastpath[MAXPATHLEN]=""; struct file_list *flist; @@ -646,24 +602,23 @@ fname = "."; if (dir && *dir) { - if (getcwd(dbuf,MAXPATHLEN-1) == NULL) { - rprintf(FERROR,"getwd : %s\n",strerror(errno)); - exit_cleanup(1); - } - if (chdir(dir) != 0) { + char *olddir = push_dir(dir, 1); + + if (!olddir) { io_error=1; - rprintf(FERROR,"chdir %s : %s\n", + rprintf(FERROR,"push_dir %s : %s\n", dir,strerror(errno)); continue; } + flist_dir = dir; if (one_file_system) set_filesystem(fname); send_file_name(f,flist,fname,recurse,FLAG_DELETE); flist_dir = NULL; - if (chdir(dbuf) != 0) { - rprintf(FERROR,"chdir %s : %s\n", - dbuf,strerror(errno)); + if (pop_dir(olddir) != 0) { + rprintf(FERROR,"pop_dir %s : %s\n", + dir,strerror(errno)); exit_cleanup(1); } continue; diff -u -r --new-file --exclude=CVS rsync-2.0.14/io.c rsync-2.0.15/io.c --- rsync-2.0.14/io.c Fri May 29 12:29:12 1998 +++ rsync-2.0.15/io.c Sat May 30 12:08:30 1998 @@ -79,6 +79,7 @@ static char *read_buffer_p; static int read_buffer_len; static int read_buffer_size; +static int no_flush; /* read from a socket with IO timeout. return the number of bytes read. If no bytes can be read then exit, never return @@ -325,6 +326,8 @@ struct timeval tv; int reading; + no_flush++; + reading = (buffer_f_in != -1 && read_buffer_len < MAX_READ_BUFFER); while (total < len) { @@ -374,6 +377,8 @@ read_check(buffer_f_in); } } + + no_flush--; } @@ -395,7 +400,7 @@ void io_flush(void) { int fd = multiplex_out_fd; - if (!io_buffer_count) return; + if (!io_buffer_count || no_flush) return; if (io_multiplexing_out) { SIVAL(io_buffer-4, 0, (MPLEX_BASE<<24) + io_buffer_count); diff -u -r --new-file --exclude=CVS rsync-2.0.14/main.c rsync-2.0.15/main.c --- rsync-2.0.14/main.c Wed May 27 23:54:32 1998 +++ rsync-2.0.15/main.c Sat May 30 12:08:30 1998 @@ -149,8 +149,8 @@ if (do_stat(name,&st) == 0) { if (S_ISDIR(st.st_mode)) { - if (chdir(name) != 0) { - rprintf(FERROR,"chdir %s : %s (1)\n", + if (!push_dir(name, 0)) { + rprintf(FERROR,"push_dir %s : %s (1)\n", name,strerror(errno)); exit_cleanup(1); } @@ -176,8 +176,9 @@ rprintf(FINFO,"created directory %s\n",name); } - if (chdir(name) != 0) { - rprintf(FERROR,"chdir %s : %s (2)\n",name,strerror(errno)); + if (!push_dir(name, 0)) { + rprintf(FERROR,"push_dir %s : %s (2)\n", + name,strerror(errno)); exit_cleanup(1); } @@ -198,8 +199,8 @@ if (verbose > 2) rprintf(FINFO,"server_sender starting pid=%d\n",(int)getpid()); - if (!relative_paths && chdir(dir) != 0) { - rprintf(FERROR,"chdir %s: %s (3)\n",dir,strerror(errno)); + if (!relative_paths && !push_dir(dir, 0)) { + rprintf(FERROR,"push_dir %s: %s (3)\n",dir,strerror(errno)); exit_cleanup(1); } argc--; @@ -289,8 +290,8 @@ dir = argv[0]; argc--; argv++; - if (!am_daemon && chdir(dir) != 0) { - rprintf(FERROR,"chdir %s : %s (4)\n", + if (!am_daemon && !push_dir(dir, 0)) { + rprintf(FERROR,"push_dir %s : %s (4)\n", dir,strerror(errno)); exit_cleanup(1); } diff -u -r --new-file --exclude=CVS rsync-2.0.14/options.c rsync-2.0.15/options.c --- rsync-2.0.14/options.c Wed May 27 23:54:33 1998 +++ rsync-2.0.15/options.c Sat May 30 12:08:30 1998 @@ -79,7 +79,7 @@ rprintf(F,"Options:\n"); rprintf(F,"-v, --verbose increase verbosity\n"); rprintf(F,"-c, --checksum always checksum\n"); - rprintf(F,"-a, --archive archive mode (same as -rlptDog)\n"); + rprintf(F,"-a, --archive archive mode\n"); rprintf(F,"-r, --recursive recurse into directories\n"); rprintf(F,"-R, --relative use relative path names\n"); rprintf(F,"-b, --backup make backups (default ~ extension)\n"); diff -u -r --new-file --exclude=CVS rsync-2.0.14/packaging/redhat/5.0/rsync.spec rsync-2.0.15/packaging/redhat/5.0/rsync.spec --- rsync-2.0.14/packaging/redhat/5.0/rsync.spec Fri May 29 12:29:32 1998 +++ rsync-2.0.15/packaging/redhat/5.0/rsync.spec Sat May 30 12:10:13 1998 @@ -1,10 +1,10 @@ Summary: Program for efficient remote updates of files. Name: rsync -Version: 2.0.14 +Version: 2.0.15 Release: 1 Copyright: GPL Group: Applications/Networking -Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.0.14.tar.gz +Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.0.15.tar.gz URL: http://samba.anu.edu.au/rsync/ Packager: Andrew Tridgell BuildRoot: /tmp/rsync diff -u -r --new-file --exclude=CVS rsync-2.0.14/proto.h rsync-2.0.15/proto.h --- rsync-2.0.14/proto.h Fri May 29 12:29:13 1998 +++ rsync-2.0.15/proto.h Sat May 30 12:08:30 1998 @@ -165,3 +165,6 @@ int vslprintf(char *str, int n, const char *format, va_list ap); int slprintf(char *str, int n, char *format, ...); void *Realloc(void *p, int size); +void clean_fname(char *name); +char *push_dir(char *dir, int save); +int pop_dir(char *dir); diff -u -r --new-file --exclude=CVS rsync-2.0.14/rsync.c rsync-2.0.15/rsync.c --- rsync-2.0.14/rsync.c Fri May 29 12:29:13 1998 +++ rsync-2.0.15/rsync.c Sat May 30 12:08:31 1998 @@ -962,7 +962,6 @@ int i; struct file_struct *file; int phase = 0; - int offset=0; if (verbose > 2) rprintf(FINFO,"send_files starting\n"); @@ -970,6 +969,8 @@ setup_readbuffer(f_in); while (1) { + int offset=0; + i = read_int(f_in); if (i == -1) { if (phase==0 && remote_version >= 13) { diff -u -r --new-file --exclude=CVS rsync-2.0.14/rsync.yo rsync-2.0.15/rsync.yo --- rsync-2.0.14/rsync.yo Wed May 27 23:54:33 1998 +++ rsync-2.0.15/rsync.yo Sat May 30 12:08:31 1998 @@ -217,8 +217,11 @@ which already exist and have the same checksum and size on the receiver are skipped. This option can be quite slow. -dit(bf(-a, --archive)) This is equivalent to -rlptDog. It is a quick way +dit(bf(-a, --archive)) This is equivalent to -rlptDg. It is a quick way of saying I want recursion and want to preserve everything. + +Note: if the user launching rsync is root then the -o option (preserve +uid) is also implied. dit(bf(-r, --recursive)) This tells rsync to copy directories recursively diff -u -r --new-file --exclude=CVS rsync-2.0.14/util.c rsync-2.0.15/util.c --- rsync-2.0.14/util.c Fri May 29 12:29:13 1998 +++ rsync-2.0.15/util.c Sat May 30 12:08:31 1998 @@ -559,3 +559,97 @@ if (!p) return (void *)malloc(size); return (void *)realloc(p, size); } + + +void clean_fname(char *name) +{ + char *p; + int l; + int modified = 1; + + if (!name) return; + + while (modified) { + modified = 0; + + if ((p=strstr(name,"/./"))) { + modified = 1; + while (*p) { + p[0] = p[2]; + p++; + } + } + + if ((p=strstr(name,"//"))) { + modified = 1; + while (*p) { + p[0] = p[1]; + p++; + } + } + + if (strncmp(p=name,"./",2) == 0) { + modified = 1; + do { + p[0] = p[2]; + } while (*p++); + } + + l = strlen(p=name); + if (l > 1 && p[l-1] == '/') { + modified = 1; + p[l-1] = 0; + } + } +} + + +static char curr_dir[MAXPATHLEN]; + +/* like chdir() but can be reversed with pop_dir() if save is set. It + is also much faster as it remembers where we have been */ +char *push_dir(char *dir, int save) +{ + char *ret = curr_dir; + static int initialised; + + if (!initialised) { + initialised = 1; + getcwd(curr_dir, sizeof(curr_dir)-1); + } + + if (chdir(dir)) return NULL; + + if (save) { + ret = strdup(curr_dir); + } + + if (*dir == '/') { + strlcpy(curr_dir, dir, sizeof(curr_dir)-1); + } else { + strlcat(curr_dir,"/", sizeof(curr_dir)-1); + strlcat(curr_dir,dir, sizeof(curr_dir)-1); + } + + clean_fname(curr_dir); + + return ret; +} + +/* reverse a push_dir call */ +int pop_dir(char *dir) +{ + int ret; + + ret = chdir(dir); + if (ret) { + free(dir); + return ret; + } + + strlcpy(curr_dir, dir, sizeof(curr_dir)-1); + + free(dir); + + return 0; +} diff -u -r --new-file --exclude=CVS rsync-2.0.14/version.h rsync-2.0.15/version.h --- rsync-2.0.14/version.h Fri May 29 12:29:31 1998 +++ rsync-2.0.15/version.h Sat May 30 12:10:11 1998 @@ -1 +1 @@ -#define VERSION "2.0.14" +#define VERSION "2.0.15" diff -u -r --new-file --exclude=CVS rsync-2.0.14/zlib/infblock.c rsync-2.0.15/zlib/infblock.c --- rsync-2.0.14/zlib/infblock.c Thu May 7 16:19:43 1998 +++ rsync-2.0.15/zlib/infblock.c Sat May 30 12:08:32 1998 @@ -176,7 +176,7 @@ break; case 3: /* illegal */ DUMPBITS(3) - s->mode = BAD; + s->mode = zBAD; z->msg = (char*)"invalid block type"; r = Z_DATA_ERROR; LEAVE @@ -186,7 +186,7 @@ NEEDBITS(32) if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) { - s->mode = BAD; + s->mode = zBAD; z->msg = (char*)"invalid stored block lengths"; r = Z_DATA_ERROR; LEAVE @@ -219,7 +219,7 @@ #ifndef PKZIP_BUG_WORKAROUND if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) { - s->mode = BAD; + s->mode = zBAD; z->msg = (char*)"too many length or distance symbols"; r = Z_DATA_ERROR; LEAVE @@ -252,7 +252,7 @@ ZFREE(z, s->sub.trees.blens); r = t; if (r == Z_DATA_ERROR) - s->mode = BAD; + s->mode = zBAD; LEAVE } s->sub.trees.index = 0; @@ -289,7 +289,7 @@ (c == 16 && i < 1)) { ZFREE(z, s->sub.trees.blens); - s->mode = BAD; + s->mode = zBAD; z->msg = (char*)"invalid bit length repeat"; r = Z_DATA_ERROR; LEAVE @@ -317,7 +317,7 @@ if (t != Z_OK) { if (t == (uInt)Z_DATA_ERROR) - s->mode = BAD; + s->mode = zBAD; r = t; LEAVE } @@ -361,7 +361,7 @@ case DONE: r = Z_STREAM_END; LEAVE - case BAD: + case zBAD: r = Z_DATA_ERROR; LEAVE default: diff -u -r --new-file --exclude=CVS rsync-2.0.14/zlib/inflate.c rsync-2.0.15/zlib/inflate.c --- rsync-2.0.14/zlib/inflate.c Thu May 7 16:19:43 1998 +++ rsync-2.0.15/zlib/inflate.c Sat May 30 12:08:32 1998 @@ -22,7 +22,7 @@ CHECK2, /* two check bytes to go */ CHECK1, /* one check byte to go */ DONE, /* finished check, done */ - BAD} /* got an error--stay here */ + zBAD} /* got an error--stay here */ inflate_mode; /* inflate private state */ @@ -38,7 +38,7 @@ uLong was; /* computed check value */ uLong need; /* stream check value */ } check; /* if CHECK, check values to compare */ - uInt marker; /* if BAD, inflateSync's marker bytes count */ + uInt marker; /* if zBAD, inflateSync's marker bytes count */ } sub; /* submode */ /* mode independent information */ @@ -164,14 +164,14 @@ NEEDBYTE if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED) { - z->state->mode = BAD; + z->state->mode = zBAD; z->msg = (char*)"unknown compression method"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } if ((z->state->sub.method >> 4) + 8 > z->state->wbits) { - z->state->mode = BAD; + z->state->mode = zBAD; z->msg = (char*)"invalid window size"; z->state->sub.marker = 5; /* can't try inflateSync */ break; @@ -182,7 +182,7 @@ b = NEXTBYTE; if (((z->state->sub.method << 8) + b) % 31) { - z->state->mode = BAD; + z->state->mode = zBAD; z->msg = (char*)"incorrect header check"; z->state->sub.marker = 5; /* can't try inflateSync */ break; @@ -213,7 +213,7 @@ z->state->mode = DICT0; return Z_NEED_DICT; case DICT0: - z->state->mode = BAD; + z->state->mode = zBAD; z->msg = (char*)"need dictionary"; z->state->sub.marker = 0; /* can try inflateSync */ return Z_STREAM_ERROR; @@ -221,7 +221,7 @@ r = inflate_blocks(z->state->blocks, z, r); if (r == Z_DATA_ERROR) { - z->state->mode = BAD; + z->state->mode = zBAD; z->state->sub.marker = 0; /* can try inflateSync */ break; } @@ -255,7 +255,7 @@ if (z->state->sub.check.was != z->state->sub.check.need) { - z->state->mode = BAD; + z->state->mode = zBAD; z->msg = (char*)"incorrect data check"; z->state->sub.marker = 5; /* can't try inflateSync */ break; @@ -264,7 +264,7 @@ z->state->mode = DONE; case DONE: return Z_STREAM_END; - case BAD: + case zBAD: return Z_DATA_ERROR; default: return Z_STREAM_ERROR; @@ -310,9 +310,9 @@ /* set up */ if (z == Z_NULL || z->state == Z_NULL) return Z_STREAM_ERROR; - if (z->state->mode != BAD) + if (z->state->mode != zBAD) { - z->state->mode = BAD; + z->state->mode = zBAD; z->state->sub.marker = 0; } if ((n = z->avail_in) == 0) diff -u -r --new-file --exclude=CVS rsync-2.0.14/zlib/infutil.h rsync-2.0.15/zlib/infutil.h --- rsync-2.0.14/zlib/infutil.h Fri May 22 23:45:43 1998 +++ rsync-2.0.15/zlib/infutil.h Sat May 30 12:08:32 1998 @@ -21,7 +21,7 @@ CODES, /* processing fixed or dynamic block */ DRY, /* output remaining window bytes */ DONE, /* finished last block, done */ - BAD} /* got a data error--stuck here */ + zBAD} /* got a data error--stuck here */ inflate_block_mode; /* inflate blocks semi-private state */