From 3f053c45eb13d143d4a3860ae5914c33756c55b5 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 13 Oct 2006 23:57:13 +0000 Subject: [PATCH] Fixed failing hunks. --- atimes.diff | 52 ++++++++++++++++++++++++------------------------ id-pair.diff | 44 ++++++++++++++++++++-------------------- ignore-case.diff | 33 ++++++++++++++++++++---------- 3 files changed, 70 insertions(+), 59 deletions(-) diff --git a/atimes.diff b/atimes.diff index beb4cfb..fe927bd 100644 --- a/atimes.diff +++ b/atimes.diff @@ -51,7 +51,7 @@ After applying this patch, run these commands for a successful build: f_name(f, NULL)); } } -@@ -298,6 +307,7 @@ static void send_file_entry(struct file_ +@@ -302,6 +311,7 @@ static void send_file_entry(struct file_ { unsigned short flags; static time_t modtime; @@ -59,7 +59,7 @@ After applying this patch, run these commands for a successful build: static mode_t mode; static int64 dev; static dev_t rdev; -@@ -313,7 +323,7 @@ static void send_file_entry(struct file_ +@@ -317,7 +327,7 @@ static void send_file_entry(struct file_ if (!file) { write_byte(f, 0); @@ -68,7 +68,7 @@ After applying this patch, run these commands for a successful build: dev = 0, rdev = MAKEDEV(0, 0); rdev_major = 0; uid = 0, gid = 0; -@@ -323,7 +333,7 @@ static void send_file_entry(struct file_ +@@ -327,7 +337,7 @@ static void send_file_entry(struct file_ f_name(file, fname); @@ -77,7 +77,7 @@ After applying this patch, run these commands for a successful build: if (file->mode == mode) flags |= XMIT_SAME_MODE; -@@ -359,6 +369,12 @@ static void send_file_entry(struct file_ +@@ -363,6 +373,12 @@ static void send_file_entry(struct file_ flags |= XMIT_SAME_TIME; else modtime = file->modtime; @@ -90,7 +90,7 @@ After applying this patch, run these commands for a successful build: #ifdef SUPPORT_HARD_LINKS if (file->link_u.idev) { -@@ -412,6 +428,8 @@ static void send_file_entry(struct file_ +@@ -416,6 +432,8 @@ static void send_file_entry(struct file_ write_int(f, modtime); if (!(flags & XMIT_SAME_MODE)) write_int(f, to_wire_mode(mode)); @@ -99,7 +99,7 @@ After applying this patch, run these commands for a successful build: if (preserve_uid && !(flags & XMIT_SAME_UID)) { if (!numeric_ids) add_uid(uid); -@@ -478,6 +496,7 @@ static struct file_struct *receive_file_ +@@ -482,6 +500,7 @@ static struct file_struct *receive_file_ unsigned short flags, int f) { static time_t modtime; @@ -107,7 +107,7 @@ After applying this patch, run these commands for a successful build: static mode_t mode; static int64 dev; static dev_t rdev; -@@ -496,7 +515,7 @@ static struct file_struct *receive_file_ +@@ -500,7 +519,7 @@ static struct file_struct *receive_file_ struct file_struct *file; if (!flist) { @@ -116,7 +116,7 @@ After applying this patch, run these commands for a successful build: dev = 0, rdev = MAKEDEV(0, 0); rdev_major = 0; uid = 0, gid = 0; -@@ -552,6 +571,8 @@ static struct file_struct *receive_file_ +@@ -556,6 +575,8 @@ static struct file_struct *receive_file_ modtime = (time_t)read_int(f); if (!(flags & XMIT_SAME_MODE)) mode = from_wire_mode(read_int(f)); @@ -125,7 +125,7 @@ After applying this patch, run these commands for a successful build: if (chmod_modes && !S_ISLNK(mode)) mode = tweak_mode(mode, chmod_modes); -@@ -607,6 +628,8 @@ static struct file_struct *receive_file_ +@@ -611,6 +632,8 @@ static struct file_struct *receive_file_ file->mode = mode; file->uid = uid; file->gid = gid; @@ -134,7 +134,7 @@ After applying this patch, run these commands for a successful build: if (dirname_len) { file->dirname = lastdir = bp; -@@ -632,12 +655,12 @@ static struct file_struct *receive_file_ +@@ -636,12 +659,12 @@ static struct file_struct *receive_file_ && lastname[del_hier_name_len-1] == '.' && lastname[del_hier_name_len-2] == '/') del_hier_name_len -= 2; @@ -149,7 +149,7 @@ After applying this patch, run these commands for a successful build: else in_del_hier = 0; } -@@ -853,12 +876,14 @@ struct file_struct *make_file(char *fnam +@@ -858,12 +881,14 @@ struct file_struct *make_file(char *fnam memset(bp, 0, file_struct_len); bp += file_struct_len; @@ -165,7 +165,7 @@ After applying this patch, run these commands for a successful build: #ifdef SUPPORT_HARD_LINKS if (flist && flist->hlink_pool) { -@@ -971,7 +996,7 @@ static void send_if_directory(int f, str +@@ -976,7 +1001,7 @@ static void send_if_directory(int f, str char is_dot_dir = fbuf[ol-1] == '.' && (ol == 1 || fbuf[ol-2] == '/'); if (S_ISDIR(file->mode) @@ -174,7 +174,7 @@ After applying this patch, run these commands for a successful build: void *save_filters; unsigned int len = strlen(fbuf); if (len > 1 && fbuf[len-1] == '/') -@@ -1581,8 +1606,9 @@ static void clean_flist(struct file_list +@@ -1589,8 +1614,9 @@ static void clean_flist(struct file_list } /* Make sure we don't lose track of a user-specified * top directory. */ @@ -186,7 +186,7 @@ After applying this patch, run these commands for a successful build: clear_file(flist->files[drop], flist); -@@ -1706,7 +1732,7 @@ static void output_flist(struct file_lis +@@ -1714,7 +1740,7 @@ static void output_flist(struct file_lis file->dirname ? file->dirname : "", file->dirname ? "/" : "", NS(file->basename), S_ISDIR(file->mode) ? "/" : "", (int)file->mode, @@ -403,7 +403,7 @@ After applying this patch, run these commands for a successful build: {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 }, {"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 }, {"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 }, -@@ -1531,6 +1536,8 @@ void server_options(char **args,int *arg +@@ -1534,6 +1539,8 @@ void server_options(char **args,int *arg argstr[x++] = 'D'; if (preserve_times) argstr[x++] = 't'; @@ -657,21 +657,21 @@ After applying this patch, run these commands for a successful build: exit(1); } -+static void storetime(char *dest, time_t t) ++static void storetime(char *dest, time_t t, size_t destsize) +{ + if (t) { + struct tm *mt = gmtime(&t); + -+ sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d ", ++ snprintf(dest, destsize, ++ "%04d-%02d-%02d %02d:%02d:%02d ", + (int)mt->tm_year + 1900, + (int)mt->tm_mon + 1, + (int)mt->tm_mday, + (int)mt->tm_hour, + (int)mt->tm_min, + (int)mt->tm_sec); -+ } else { -+ strcpy(dest, " "); -+ } ++ } else ++ strlcpy(dest, " ", destsize); +} + static void list_file(const char *fname) @@ -692,18 +692,18 @@ After applying this patch, run these commands for a successful build: - if (buf.st_mtime) { - mt = gmtime(&buf.st_mtime); - -- sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d", +- snprintf(datebuf, sizeof datebuf, +- "%04d-%02d-%02d %02d:%02d:%02d", - (int)mt->tm_year + 1900, - (int)mt->tm_mon + 1, - (int)mt->tm_mday, - (int)mt->tm_hour, - (int)mt->tm_min, - (int)mt->tm_sec); -- } else { -- strcpy(datebuf, " "); -- } -+ storetime(mtimebuf, buf.st_mtime); -+ storetime(atimebuf, buf.st_atime); +- } else +- strlcpy(datebuf, " ", sizeof datebuf); ++ storetime(mtimebuf, buf.st_mtime, sizeof mtimebuf); ++ storetime(atimebuf, buf.st_atime, sizeof atimebuf); /* TODO: Perhaps escape special characters in fname? */ diff --git a/id-pair.diff b/id-pair.diff index 078ac43..23922a2 100644 --- a/id-pair.diff +++ b/id-pair.diff @@ -18,7 +18,7 @@ gets to be really large. extern struct file_list *the_file_list; extern char curr_dir[MAXPATHLEN]; -@@ -347,14 +348,14 @@ static void send_file_entry(struct file_ +@@ -351,14 +352,14 @@ static void send_file_entry(struct file_ } } else if (protocol_version < 28) rdev = MAKEDEV(0, 0); @@ -37,7 +37,7 @@ gets to be really large. if (file->modtime == modtime) flags |= XMIT_SAME_TIME; else -@@ -605,8 +606,7 @@ static struct file_struct *receive_file_ +@@ -609,8 +610,7 @@ static struct file_struct *receive_file_ file->modtime = modtime; file->length = file_length; file->mode = mode; @@ -47,7 +47,7 @@ gets to be really large. if (dirname_len) { file->dirname = lastdir = bp; -@@ -857,8 +857,7 @@ struct file_struct *make_file(char *fnam +@@ -862,8 +862,7 @@ struct file_struct *make_file(char *fnam file->modtime = st.st_mtime; file->length = st.st_size; file->mode = st.st_mode; @@ -57,7 +57,7 @@ gets to be really large. #ifdef SUPPORT_HARD_LINKS if (flist && flist->hlink_pool) { -@@ -926,8 +925,7 @@ struct file_struct *make_file(char *fnam +@@ -931,8 +930,7 @@ struct file_struct *make_file(char *fnam file->modtime = st2.st_mtime; file->length = st2.st_size; file->mode = st2.st_mode; @@ -67,7 +67,7 @@ gets to be really large. file->u.link = NULL; } else file->mode = save_mode; -@@ -1379,7 +1377,7 @@ struct file_list *recv_file_list(int f) +@@ -1383,7 +1381,7 @@ struct file_list *recv_file_list(int f) clean_flist(flist, relative_paths, 1); if (f >= 0) { @@ -76,31 +76,31 @@ gets to be really large. /* Recv the io_error flag */ if (lp_ignore_errors(module_id) || ignore_errors) -@@ -1695,13 +1693,15 @@ static void output_flist(struct file_lis +@@ -1699,13 +1697,15 @@ static void output_flist(struct file_lis for (i = 0; i < flist->count; i++) { file = flist->files[i]; - if ((am_root || am_sender) && preserve_uid) -- sprintf(uidbuf, " uid=%ld", (long)file->uid); +- snprintf(uidbuf, sizeof uidbuf, " uid=%ld", (long)file->uid); - else + if ((am_root || am_sender) && preserve_uid) { -+ sprintf(uidbuf, " uid=%ld", ++ snprintf(uidbuf, sizeof uidbuf, " uid=%ld", + (long)id_pairs[file->id_ndx].uid); + } else *uidbuf = '\0'; - if (preserve_gid && file->gid != GID_NONE) -- sprintf(gidbuf, " gid=%ld", (long)file->gid); +- snprintf(gidbuf, sizeof gidbuf, " gid=%ld", (long)file->gid); - else + if (preserve_gid && id_pairs[file->id_ndx].gid != GID_NONE) { -+ sprintf(gidbuf, " gid=%ld", ++ snprintf(gidbuf, sizeof gidbuf, " gid=%ld", + (long)id_pairs[file->id_ndx].gid); + } else *gidbuf = '\0'; if (!am_sender) - sprintf(depthbuf, "%d", file->dir.depth); + snprintf(depthbuf, sizeof depthbuf, "%d", file->dir.depth); --- old/generator.c +++ new/generator.c -@@ -89,6 +89,7 @@ extern dev_t filesystem_dev; +@@ -90,6 +90,7 @@ extern dev_t filesystem_dev; extern char *backup_dir; extern char *backup_suffix; extern int backup_suffix_len; @@ -108,7 +108,7 @@ gets to be really large. extern struct file_list *the_file_list; extern struct filter_list_struct server_filter_list; -@@ -322,10 +323,12 @@ int unchanged_attrs(struct file_struct * +@@ -323,10 +324,12 @@ int unchanged_attrs(struct file_struct * && (st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) return 0; @@ -123,7 +123,7 @@ gets to be really large. return 0; return 1; -@@ -338,6 +341,8 @@ void itemize(struct file_struct *file, i +@@ -339,6 +342,8 @@ void itemize(struct file_struct *file, i int keep_time = !preserve_times ? 0 : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode); @@ -132,7 +132,7 @@ gets to be really large. if (S_ISREG(file->mode) && file->length != st->st_size) iflags |= ITEM_REPORT_SIZE; -@@ -347,10 +352,10 @@ void itemize(struct file_struct *file, i +@@ -348,10 +353,10 @@ void itemize(struct file_struct *file, i iflags |= ITEM_REPORT_TIME; if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS)) iflags |= ITEM_REPORT_PERMS; @@ -148,7 +148,7 @@ gets to be really large. iflags |= ITEM_IS_NEW; --- old/log.c +++ new/log.c -@@ -46,6 +46,7 @@ extern char *auth_user; +@@ -47,6 +47,7 @@ extern char *auth_user; extern char *stdout_format; extern char *logfile_format; extern char *logfile_name; @@ -156,7 +156,7 @@ gets to be really large. #if defined HAVE_ICONV_OPEN && defined HAVE_ICONV_H extern iconv_t ic_chck; #endif -@@ -471,16 +472,16 @@ static void log_formatted(enum logcode c +@@ -479,16 +480,16 @@ static void log_formatted(enum logcode c case 'U': strlcat(fmt, "ld", sizeof fmt); snprintf(buf2, sizeof buf2, fmt, @@ -235,8 +235,8 @@ gets to be really large. rsyserr(FERROR, errno, "%s %s failed", --- old/rsync.h +++ new/rsync.h -@@ -502,6 +502,11 @@ struct hlink { - int hlindex; +@@ -503,6 +503,11 @@ struct hlink { + unsigned short link_dest_used; }; +struct id_pair { @@ -247,7 +247,7 @@ gets to be really large. #define F_DEV link_u.idev->dev #define F_INODE link_u.idev->inode -@@ -526,8 +531,7 @@ struct file_struct { +@@ -527,8 +532,7 @@ struct file_struct { struct hlink *links; } link_u; time_t modtime; @@ -277,7 +277,7 @@ gets to be really large. static struct idlist *add_to_list(struct idlist **root, int id, char *name, int id2) { -@@ -308,7 +312,7 @@ void send_uid_list(int f) +@@ -306,7 +310,7 @@ void send_uid_list(int f) /* recv a complete uid/gid mapping from the peer and map the uid/gid * in the file list to local names */ @@ -286,7 +286,7 @@ gets to be really large. { int id, i; char *name; -@@ -339,11 +343,40 @@ void recv_uid_list(int f, struct file_li +@@ -337,11 +341,40 @@ void recv_uid_list(int f, struct file_li /* Now convert all the uids/gids from sender values to our values. */ if (am_root && preserve_uid && !numeric_ids) { diff --git a/ignore-case.diff b/ignore-case.diff index 267ebb0..0ac2402 100644 --- a/ignore-case.diff +++ b/ignore-case.diff @@ -3,7 +3,7 @@ in a case-insensitive manner. --- old/flist.c +++ new/flist.c -@@ -37,6 +37,7 @@ extern int am_sender; +@@ -32,6 +32,7 @@ extern int am_sender; extern int do_progress; extern int always_checksum; extern int module_id; @@ -11,11 +11,20 @@ in a case-insensitive manner. extern int ignore_errors; extern int numeric_ids; extern int recurse; -@@ -1801,7 +1802,14 @@ int f_name_cmp(struct file_struct *f1, s +@@ -1786,7 +1787,7 @@ int f_name_cmp(struct file_struct *f1, s + if (type1 != type2) return type1 == t_PATH ? 1 : -1; - while (1) { -- if ((dif = (int)*c1++ - (int)*c2++) != 0) +- do { ++ while (1) { + if (!*c1) { + switch (state1) { + case s_DIR: +@@ -1849,7 +1850,16 @@ int f_name_cmp(struct file_struct *f1, s + if (type1 != type2) + return type1 == t_PATH ? 1 : -1; + } +- } while ((dif = (int)*c1++ - (int)*c2++) == 0); + if (ignore_case) { + uchar ch1, ch2; + ch1 = islower(*c1) ? toupper(*c1) : *c1; @@ -24,9 +33,11 @@ in a case-insensitive manner. + if ((dif = (int)ch1 - (int)ch2) != 0) + break; + } else if ((dif = (int)*c1++ - (int)*c2++) != 0) - break; - if (!*c1) { - switch (state1) { ++ break; ++ } + + return dif; + } --- old/lib/wildmatch.c +++ new/lib/wildmatch.c @@ -53,6 +53,8 @@ @@ -73,7 +84,7 @@ in a case-insensitive manner. int blocking_io = -1; int checksum_seed = 0; int inplace = 0; -@@ -350,6 +351,7 @@ void usage(enum logcode F) +@@ -359,6 +360,7 @@ void usage(enum logcode F) rprintf(F," --include-from=FILE read include patterns from FILE\n"); rprintf(F," --files-from=FILE read list of source-file names from FILE\n"); rprintf(F," -0, --from0 all *-from/filter files are delimited by 0s\n"); @@ -81,7 +92,7 @@ in a case-insensitive manner. rprintf(F," --address=ADDRESS bind address for outgoing socket to daemon\n"); rprintf(F," --port=PORT specify double-colon alternate port number\n"); rprintf(F," --sockopts=OPTIONS specify custom TCP options\n"); -@@ -503,6 +505,7 @@ static struct poptOption long_options[] +@@ -521,6 +523,7 @@ static struct poptOption long_options[] {"only-write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_ONLY_WRITE_BATCH, 0, 0 }, {"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 }, {"from0", '0', POPT_ARG_NONE, &eol_nulls, 0, 0, 0}, @@ -89,7 +100,7 @@ in a case-insensitive manner. {"numeric-ids", 0, POPT_ARG_NONE, &numeric_ids, 0, 0, 0 }, {"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 }, {"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 }, -@@ -1657,6 +1660,9 @@ void server_options(char **args,int *arg +@@ -1684,6 +1687,9 @@ void server_options(char **args,int *arg args[ac++] = arg; } @@ -101,7 +112,7 @@ in a case-insensitive manner. args[ac++] = "--partial-dir"; --- old/wildtest.c +++ new/wildtest.c -@@ -16,6 +16,7 @@ int fnmatch_errors = 0; +@@ -32,6 +32,7 @@ int fnmatch_errors = 0; #endif int wildmatch_errors = 0; -- 2.34.1