I got a compiler warning on line 562 of receiver.c when I compiled rsync with ACLs from CVS. The compiler did not like the assignment of file->dirname (a const char *) to dn (a char *). The attached metapatch to acls.diff fixes the warning and updates some line numbers.
Matt
### Eclipse Workspace Patch 1.0 #P rsync Index: patches/acls.diff =================================================================== RCS file: /cvsroot/rsync/patches/acls.diff,v retrieving revision 1.166 diff -u -r1.166 acls.diff --- patches/acls.diff 21 Nov 2006 08:52:10 -0000 1.166 +++ patches/acls.diff 24 Nov 2006 23:31:50 -0000 @@ -1335,7 +1335,7 @@ #ifdef SUPPORT_LINKS if (preserve_links && S_ISLNK(f->mode)) { rprintf(FINFO, "%s %11.0f %s %s -> %s\n", -@@ -497,6 +500,9 @@ static struct file_struct *receive_file_ +@@ -496,6 +499,9 @@ static struct file_struct *receive_file_ char thisname[MAXPATHLEN]; unsigned int l1 = 0, l2 = 0; int alloc_len, basename_len, dirname_len, linkname_len, sum_len; @@ -1345,7 +1345,7 @@ OFF_T file_length; char *basename, *dirname, *bp; struct file_struct *file; -@@ -600,13 +606,27 @@ static struct file_struct *receive_file_ +@@ -599,13 +605,27 @@ static struct file_struct *receive_file_ sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0; @@ -1373,7 +1373,7 @@ file->modtime = modtime; file->length = file_length; -@@ -701,6 +721,11 @@ static struct file_struct *receive_file_ +@@ -700,6 +720,11 @@ static struct file_struct *receive_file_ read_buf(f, sum, checksum_len); } @@ -1385,7 +1385,7 @@ return file; } -@@ -958,6 +983,9 @@ static struct file_struct *send_file_nam +@@ -957,6 +982,9 @@ static struct file_struct *send_file_nam unsigned short flags) { struct file_struct *file; @@ -1395,7 +1395,7 @@ file = make_file(fname, flist, stp, flags, f == -2 ? SERVER_FILTERS : ALL_FILTERS); -@@ -967,6 +995,15 @@ static struct file_struct *send_file_nam +@@ -966,6 +994,15 @@ static struct file_struct *send_file_nam if (chmod_modes && !S_ISLNK(file->mode)) file->mode = tweak_mode(file->mode, chmod_modes); @@ -1411,7 +1411,7 @@ maybe_emit_filelist_progress(flist->count + flist_count_offset); flist_expand(flist); -@@ -974,6 +1011,15 @@ static struct file_struct *send_file_nam +@@ -973,6 +1010,15 @@ static struct file_struct *send_file_nam if (file->basename[0]) { flist->files[flist->count++] = file; send_file_entry(file, f); @@ -1445,7 +1445,7 @@ extern struct stats stats; extern dev_t filesystem_dev; extern char *backup_dir; -@@ -379,22 +381,27 @@ static void do_delete_pass(struct file_l +@@ -445,22 +447,27 @@ static void do_delete_pass(struct file_l rprintf(FINFO, " \r"); } @@ -1478,7 +1478,7 @@ int32 iflags, uchar fnamecmp_type, const char *xname) { if (statret >= 0) { /* A from-dest-dir statret can == 1! */ -@@ -402,20 +409,24 @@ void itemize(struct file_struct *file, i +@@ -468,20 +475,24 @@ void itemize(struct file_struct *file, i : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode); @@ -1508,7 +1508,7 @@ } else iflags |= ITEM_IS_NEW; -@@ -668,7 +679,7 @@ void check_for_finished_hlinks(int itemi +@@ -734,7 +745,7 @@ void check_for_finished_hlinks(int itemi * handling the file, -1 if no dest-linking occurred, or a non-negative * value if we found an alternate basis file. */ static int try_dests_reg(struct file_struct *file, char *fname, int ndx, @@ -1517,7 +1517,7 @@ int maybe_ATTRS_REPORT, enum logcode code) { int best_match = -1; -@@ -677,7 +688,7 @@ static int try_dests_reg(struct file_str +@@ -743,7 +754,7 @@ static int try_dests_reg(struct file_str do { pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1526,7 +1526,7 @@ continue; switch (match_level) { case 0: -@@ -685,16 +696,20 @@ static int try_dests_reg(struct file_str +@@ -751,16 +762,20 @@ static int try_dests_reg(struct file_str match_level = 1; /* FALL THROUGH */ case 1: @@ -1550,7 +1550,7 @@ continue; best_match = j; match_level = 3; -@@ -709,7 +724,7 @@ static int try_dests_reg(struct file_str +@@ -775,7 +790,7 @@ static int try_dests_reg(struct file_str if (j != best_match) { j = best_match; pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1559,7 +1559,7 @@ return -1; } -@@ -717,7 +732,7 @@ static int try_dests_reg(struct file_str +@@ -783,7 +798,7 @@ static int try_dests_reg(struct file_str #ifdef SUPPORT_HARD_LINKS if (link_dest) { int i = itemizing && (verbose > 1 || stdout_format_has_i > 1); @@ -1568,7 +1568,7 @@ cmpbuf, 1, i, code) < 0) goto try_a_copy; if (preserve_hard_links && file->link_u.links) { -@@ -727,8 +742,13 @@ static int try_dests_reg(struct file_str +@@ -793,8 +808,13 @@ static int try_dests_reg(struct file_str } } else #endif @@ -1584,7 +1584,7 @@ if (verbose > 1 && maybe_ATTRS_REPORT) { rprintf(FCLIENT, "%s is uptodate\n", fname); } -@@ -744,8 +764,13 @@ static int try_dests_reg(struct file_str +@@ -810,8 +830,13 @@ static int try_dests_reg(struct file_str } return -1; } @@ -1600,7 +1600,7 @@ set_file_attrs(fname, file, NULL, 0); if (maybe_ATTRS_REPORT && ((!itemizing && verbose && match_level == 2) -@@ -766,7 +791,7 @@ static int try_dests_reg(struct file_str +@@ -832,7 +857,7 @@ static int try_dests_reg(struct file_str * handling the file, or -1 if no dest-linking occurred, or a non-negative * value if we found an alternate basis file. */ static int try_dests_non(struct file_struct *file, char *fname, int ndx, @@ -1609,7 +1609,7 @@ int maybe_ATTRS_REPORT, enum logcode code) { char lnk[MAXPATHLEN]; -@@ -798,24 +823,24 @@ static int try_dests_non(struct file_str +@@ -864,24 +889,24 @@ static int try_dests_non(struct file_str do { pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1639,7 +1639,7 @@ continue; break; #endif -@@ -829,7 +854,7 @@ static int try_dests_non(struct file_str +@@ -895,7 +920,7 @@ static int try_dests_non(struct file_str break; case TYPE_SPECIAL: case TYPE_DEVICE: @@ -1648,7 +1648,7 @@ continue; break; #ifdef SUPPORT_LINKS -@@ -846,7 +871,11 @@ static int try_dests_non(struct file_str +@@ -912,7 +937,11 @@ static int try_dests_non(struct file_str match_level = 2; best_match = j; } @@ -1661,7 +1661,7 @@ match_level = 3; best_match = j; break; -@@ -859,7 +888,7 @@ static int try_dests_non(struct file_str +@@ -925,7 +954,7 @@ static int try_dests_non(struct file_str if (j != best_match) { j = best_match; pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); @@ -1670,7 +1670,7 @@ return -1; } -@@ -890,7 +919,15 @@ static int try_dests_non(struct file_str +@@ -956,7 +985,15 @@ static int try_dests_non(struct file_str : ITEM_LOCAL_CHANGE + (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0); char *lp = match_level == 3 ? "" : NULL; @@ -1687,7 +1687,7 @@ } if (verbose > 1 && maybe_ATTRS_REPORT) { rprintf(FCLIENT, "%s%s is uptodate\n", -@@ -903,6 +940,7 @@ static int try_dests_non(struct file_str +@@ -969,6 +1006,7 @@ static int try_dests_non(struct file_str } static int phase = 0; @@ -1695,7 +1695,7 @@ /* Acts on the_file_list->file's ndx'th item, whose name is fname. If a dir, * make sure it exists, and has the right permissions/timestamp info. For -@@ -924,7 +962,8 @@ static void recv_generator(char *fname, +@@ -990,7 +1028,8 @@ static void recv_generator(char *fname, static int need_fuzzy_dirlist = 0; struct file_struct *fuzzy_file = NULL; int fd = -1, f_copy = -1; @@ -1705,7 +1705,7 @@ struct file_struct *back_file = NULL; int statret, real_ret, stat_errno; char *fnamecmp, *partialptr, *backupptr = NULL; -@@ -980,6 +1019,9 @@ static void recv_generator(char *fname, +@@ -1046,6 +1085,9 @@ static void recv_generator(char *fname, } else if (!dry_run) return; } @@ -1715,7 +1715,7 @@ if (dry_run > 1) { statret = -1; stat_errno = ENOENT; -@@ -987,7 +1029,7 @@ static void recv_generator(char *fname, +@@ -1053,7 +1095,7 @@ static void recv_generator(char *fname, const char *dn = file->dirname ? file->dirname : "."; if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) { if (relative_paths && !implied_dirs @@ -1724,7 +1724,7 @@ && create_directory_path(fname) < 0) { rsyserr(FERROR, errno, "recv_generator: mkdir %s failed", -@@ -999,6 +1041,10 @@ static void recv_generator(char *fname, +@@ -1065,6 +1107,10 @@ static void recv_generator(char *fname, } if (fuzzy_basis) need_fuzzy_dirlist = 1; @@ -1735,7 +1735,7 @@ } parent_dirname = dn; -@@ -1008,7 +1054,7 @@ static void recv_generator(char *fname, +@@ -1074,7 +1120,7 @@ static void recv_generator(char *fname, need_fuzzy_dirlist = 0; } @@ -1744,7 +1744,7 @@ keep_dirlinks && S_ISDIR(file->mode)); stat_errno = errno; } -@@ -1026,8 +1072,9 @@ static void recv_generator(char *fname, +@@ -1092,8 +1138,9 @@ static void recv_generator(char *fname, * mode based on the local permissions and some heuristics. */ if (!preserve_perms) { int exists = statret == 0 @@ -1756,7 +1756,7 @@ } if (S_ISDIR(file->mode)) { -@@ -1036,8 +1083,8 @@ static void recv_generator(char *fname, +@@ -1102,8 +1149,8 @@ static void recv_generator(char *fname, * file of that name and it is *not* a directory, then * we need to delete it. If it doesn't exist, then * (perhaps recursively) create it. */ @@ -1767,7 +1767,7 @@ return; statret = -1; } -@@ -1046,14 +1093,14 @@ static void recv_generator(char *fname, +@@ -1112,14 +1159,14 @@ static void recv_generator(char *fname, dry_run++; } real_ret = statret; @@ -1784,7 +1784,7 @@ itemizing, maybe_ATTRS_REPORT, code); if (j == -2) { itemizing = 0; -@@ -1062,7 +1109,11 @@ static void recv_generator(char *fname, +@@ -1128,7 +1175,11 @@ static void recv_generator(char *fname, statret = 1; } if (itemizing && f_out != -1) { @@ -1797,7 +1797,7 @@ statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL); } if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) { -@@ -1082,21 +1133,21 @@ static void recv_generator(char *fname, +@@ -1148,21 +1199,21 @@ static void recv_generator(char *fname, return; } } @@ -1825,7 +1825,7 @@ if (preserve_links && S_ISLNK(file->mode)) { #ifdef SUPPORT_LINKS -@@ -1114,15 +1165,15 @@ static void recv_generator(char *fname, +@@ -1180,15 +1231,15 @@ static void recv_generator(char *fname, char lnk[MAXPATHLEN]; int len; @@ -1844,7 +1844,7 @@ if (preserve_hard_links && file->link_u.links) hard_link_cluster(file, ndx, itemizing, code); if (remove_source_files == 1) -@@ -1131,10 +1182,10 @@ static void recv_generator(char *fname, +@@ -1197,10 +1248,10 @@ static void recv_generator(char *fname, } /* Not the right symlink (or not a symlink), so * delete it. */ @@ -1857,7 +1857,7 @@ itemizing, maybe_ATTRS_REPORT, code); if (j == -2) { #ifndef CAN_HARDLINK_SYMLINK -@@ -1150,7 +1201,7 @@ static void recv_generator(char *fname, +@@ -1216,7 +1267,7 @@ static void recv_generator(char *fname, statret = 1; } if (preserve_hard_links && file->link_u.links @@ -1866,7 +1866,7 @@ itemizing, code, HL_SKIP)) return; if (do_symlink(file->u.link, fname) != 0) { -@@ -1159,7 +1210,7 @@ static void recv_generator(char *fname, +@@ -1225,7 +1276,7 @@ static void recv_generator(char *fname, } else { set_file_attrs(fname, file, NULL, 0); if (itemizing) { @@ -1875,7 +1875,7 @@ ITEM_LOCAL_CHANGE, 0, NULL); } if (code != FNONE && verbose) -@@ -1181,31 +1232,36 @@ static void recv_generator(char *fname, +@@ -1247,31 +1298,36 @@ static void recv_generator(char *fname, if (statret == 0) { char *t; if (IS_DEVICE(file->mode)) { @@ -1922,7 +1922,7 @@ itemizing, maybe_ATTRS_REPORT, code); if (j == -2) { #ifndef CAN_HARDLINK_SPECIAL -@@ -1221,7 +1277,7 @@ static void recv_generator(char *fname, +@@ -1287,7 +1343,7 @@ static void recv_generator(char *fname, statret = 1; } if (preserve_hard_links && file->link_u.links @@ -1931,7 +1931,7 @@ itemizing, code, HL_SKIP)) return; if (verbose > 2) { -@@ -1234,7 +1290,11 @@ static void recv_generator(char *fname, +@@ -1300,7 +1356,11 @@ static void recv_generator(char *fname, } else { set_file_attrs(fname, file, NULL, 0); if (itemizing) { @@ -1944,7 +1944,7 @@ ITEM_LOCAL_CHANGE, 0, NULL); } if (code != FNONE && verbose) -@@ -1244,7 +1304,7 @@ static void recv_generator(char *fname, +@@ -1310,7 +1370,7 @@ static void recv_generator(char *fname, if (remove_source_files == 1) goto return_with_success; } @@ -1953,7 +1953,7 @@ } if (!S_ISREG(file->mode)) { -@@ -1278,7 +1338,7 @@ static void recv_generator(char *fname, +@@ -1344,7 +1404,7 @@ static void recv_generator(char *fname, } if (update_only && statret == 0 @@ -1962,7 +1962,7 @@ if (verbose > 1) rprintf(FINFO, "%s is newer\n", fname); return; -@@ -1287,20 +1347,20 @@ static void recv_generator(char *fname, +@@ -1353,20 +1413,20 @@ static void recv_generator(char *fname, fnamecmp = fname; fnamecmp_type = FNAMECMP_FNAME; @@ -1987,7 +1987,7 @@ } if (j >= 0) { fnamecmp = fnamecmpbuf; -@@ -1310,7 +1370,7 @@ static void recv_generator(char *fname, +@@ -1376,7 +1436,7 @@ static void recv_generator(char *fname, } real_ret = statret; @@ -1996,7 +1996,7 @@ if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL && link_stat(partialptr, &partial_st, 0) == 0 -@@ -1329,7 +1389,7 @@ static void recv_generator(char *fname, +@@ -1395,7 +1455,7 @@ static void recv_generator(char *fname, rprintf(FINFO, "fuzzy basis selected for %s: %s\n", fname, fnamecmpbuf); } @@ -2005,7 +2005,7 @@ statret = 0; fnamecmp = fnamecmpbuf; fnamecmp_type = FNAMECMP_FUZZY; -@@ -1338,7 +1398,7 @@ static void recv_generator(char *fname, +@@ -1404,7 +1464,7 @@ static void recv_generator(char *fname, if (statret != 0) { if (preserve_hard_links && file->link_u.links @@ -2014,7 +2014,7 @@ itemizing, code, HL_SKIP)) return; if (stat_errno == ENOENT) -@@ -1348,39 +1408,52 @@ static void recv_generator(char *fname, +@@ -1414,39 +1474,52 @@ static void recv_generator(char *fname, return; } @@ -2074,7 +2074,7 @@ fnamecmp = partialptr; fnamecmp_type = FNAMECMP_PARTIAL_DIR; statret = 0; -@@ -1404,17 +1477,21 @@ static void recv_generator(char *fname, +@@ -1470,17 +1543,21 @@ static void recv_generator(char *fname, pretend_missing: /* pretend the file didn't exist */ if (preserve_hard_links && file->link_u.links @@ -2099,7 +2099,7 @@ } if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) { close(fd); -@@ -1425,7 +1502,7 @@ static void recv_generator(char *fname, +@@ -1491,7 +1568,7 @@ static void recv_generator(char *fname, full_fname(backupptr)); free(back_file); close(fd); @@ -2108,7 +2108,7 @@ } if ((f_copy = do_open(backupptr, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) { -@@ -1433,14 +1510,14 @@ static void recv_generator(char *fname, +@@ -1499,14 +1576,14 @@ static void recv_generator(char *fname, full_fname(backupptr)); free(back_file); close(fd); @@ -2125,7 +2125,7 @@ } if (verbose > 2) -@@ -1458,24 +1535,32 @@ static void recv_generator(char *fname, +@@ -1524,24 +1601,32 @@ static void recv_generator(char *fname, iflags |= ITEM_BASIS_TYPE_FOLLOWS; if (fnamecmp_type == FNAMECMP_FUZZY) iflags |= ITEM_XNAME_FOLLOWS; @@ -2163,7 +2163,7 @@ if (f_copy >= 0) { close(f_copy); -@@ -1488,6 +1573,13 @@ static void recv_generator(char *fname, +@@ -1554,6 +1639,13 @@ static void recv_generator(char *fname, } close(fd); @@ -2177,7 +2177,7 @@ } void generate_files(int f_out, struct file_list *flist, char *local_name) -@@ -1547,6 +1639,8 @@ void generate_files(int f_out, struct fi +@@ -1615,6 +1707,8 @@ void generate_files(int f_out, struct fi * notice that and let us know via the redo pipe (or its closing). */ ignore_timeout = 1; @@ -5703,7 +5703,7 @@ rprintf(F," -o, --owner preserve owner (super-user only)\n"); rprintf(F," -g, --group preserve group\n"); rprintf(F," --devices preserve device files (super-user only)\n"); -@@ -425,6 +433,9 @@ static struct poptOption long_options[] +@@ -426,6 +434,9 @@ static struct poptOption long_options[] {"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 }, {"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 }, {"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 }, @@ -5713,7 +5713,7 @@ {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, -@@ -1089,6 +1100,24 @@ int parse_arguments(int *argc, const cha +@@ -1091,6 +1102,24 @@ int parse_arguments(int *argc, const cha usage(FINFO); exit_cleanup(0); @@ -5738,7 +5738,7 @@ default: /* A large opt value means that set_refuse_options() * turned this option off. */ -@@ -1531,6 +1560,10 @@ void server_options(char **args,int *arg +@@ -1533,6 +1562,10 @@ void server_options(char **args,int *arg if (preserve_hard_links) argstr[x++] = 'H'; @@ -5765,7 +5765,7 @@ int max_phase = protocol_version >= 29 ? 2 : 1; + int dflt_perms = (ACCESSPERMS & ~orig_umask); +#ifdef SUPPORT_ACLS -+ char *parent_dirname = ""; ++ const char *parent_dirname = ""; +#endif int i, recv_ok; @@ -5776,7 +5776,7 @@ int exists = fd1 != -1; - file->mode = dest_mode(file->mode, st.st_mode, exists); +#ifdef SUPPORT_ACLS -+ char *dn = file->dirname ? file->dirname : "."; ++ const char *dn = file->dirname ? file->dirname : "."; + if (parent_dirname != dn + && strcmp(parent_dirname, dn) != 0) { + dflt_perms = default_perms_for_dir(dn); @@ -6012,9 +6012,9 @@ #include "byteorder.h" #include "lib/mdfour.h" #include "lib/wildmatch.h" -@@ -669,6 +688,16 @@ struct chmod_mode_struct; - #define UNUSED(x) x __attribute__((__unused__)) +@@ -674,6 +693,16 @@ struct chmod_mode_struct; #define NORETURN __attribute__((__noreturn__)) + #endif +typedef struct { + STRUCT_STAT st; @@ -6048,7 +6048,7 @@ -o, --owner preserve owner (super-user only) -g, --group preserve group --devices preserve device files (super-user only) -@@ -753,7 +754,9 @@ quote(itemization( +@@ -754,7 +755,9 @@ quote(itemization( permissions, though the bf(--executability) option might change just the execute permission for the file. it() New files get their "normal" permission bits set to the source @@ -6059,7 +6059,7 @@ their special permission bits disabled except in the case where a new directory inherits a setgid bit from its parent directory. )) -@@ -784,9 +787,11 @@ The preservation of the destination's se +@@ -785,9 +788,11 @@ The preservation of the destination's se directories when bf(--perms) is off was added in rsync 2.6.7. Older rsync versions erroneously preserved the three special permission bits for newly-created files when bf(--perms) was off, while overriding the @@ -6074,7 +6074,7 @@ dit(bf(-E, --executability)) This option causes rsync to preserve the executability (or non-executability) of regular files when bf(--perms) is -@@ -804,6 +809,15 @@ quote(itemization( +@@ -805,6 +810,15 @@ quote(itemization( If bf(--perms) is enabled, this option is ignored. @@ -6090,7 +6090,7 @@ dit(bf(--chmod)) This option tells rsync to apply one or more comma-separated "chmod" strings to the permission of the files in the transfer. The resulting value is treated as though it was the permissions -@@ -1395,8 +1409,8 @@ if the receiving rsync is at least versi +@@ -1402,8 +1416,8 @@ if the receiving rsync is at least versi with older versions of rsync, but that also turns on the output of other verbose messages). @@ -6101,7 +6101,7 @@ type of update being done, bf(X) is replaced by the file-type, and the other letters represent attributes that may be output if they are being modified. -@@ -1445,7 +1459,11 @@ quote(itemization( +@@ -1452,7 +1466,11 @@ quote(itemization( sender's value (requires bf(--owner) and super-user privileges). it() A bf(g) means the group is different and is being updated to the sender's value (requires bf(--group) and the authority to set the group).
-- To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html