X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/548aa120c03a7b405ec743e1fac7d9284e35c054..cad12f627670106269929565f075db42ca2e06c0:/chmod-option.diff diff --git a/chmod-option.diff b/chmod-option.diff index 6cd8e36..7e22aeb 100644 --- a/chmod-option.diff +++ b/chmod-option.diff @@ -1,5 +1,11 @@ ---- Makefile.in 10 Feb 2004 17:06:11 -0000 1.98 -+++ Makefile.in 20 Mar 2004 17:56:44 -0000 +After applying this patch and running configure, you MUST run this +command before "make": + + make proto + + +--- orig/Makefile.in 2004-08-13 07:18:58 ++++ Makefile.in 2004-07-03 20:13:41 @@ -34,7 +34,7 @@ ZLIBOBJ=zlib/deflate.o zlib/infblock.o z OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o \ main.o checksum.o match.o syscall.o log.o backup.o @@ -9,8 +15,8 @@ OBJS3=progress.o pipe.o DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \ ---- chmod.c 2004-02-13 17:08:33.000000000 -0800 -+++ chmod.c 2004-03-20 10:04:19.000000000 -0800 +--- orig/chmod.c 2004-06-18 17:22:08 ++++ chmod.c 2004-06-18 17:22:08 @@ -0,0 +1,184 @@ +#include "rsync.h" + @@ -196,40 +202,32 @@ + } + return 0; +} ---- flist.c 11 Feb 2004 02:48:58 -0000 1.205 -+++ flist.c 20 Mar 2004 17:56:45 -0000 -@@ -33,6 +33,7 @@ extern int verbose; - extern int do_progress; - extern int am_root; - extern int am_server; -+extern int am_sender; - extern int always_checksum; - extern int module_id; - extern int ignore_errors; -@@ -63,6 +64,8 @@ extern int sanitize_paths; - extern int read_batch; - extern int write_batch; +--- orig/flist.c 2004-09-21 09:40:27 ++++ flist.c 2004-09-18 01:51:11 +@@ -65,6 +65,8 @@ extern int delete_excluded; + extern int orig_umask; + extern int list_only; +extern struct chmod_mode_struct *chmod_modes; + - extern struct exclude_struct **exclude_list; - extern struct exclude_struct **server_exclude_list; - extern struct exclude_struct **local_exclude_list; -@@ -831,7 +834,10 @@ skip_excludes: + extern struct exclude_list_struct exclude_list; + extern struct exclude_list_struct server_exclude_list; + extern struct exclude_list_struct local_exclude_list; +@@ -869,7 +871,10 @@ skip_excludes: file->flags = flags; file->modtime = st.st_mtime; file->length = st.st_size; - file->mode = st.st_mode; -+ if (chmod_modes && am_sender && S_ISREG(st.st_mode)) ++ if (chmod_modes && am_sender && (S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) + file->mode = tweak_mode(st.st_mode, chmod_modes); + else + file->mode = st.st_mode; file->uid = st.st_uid; file->gid = st.st_gid; ---- options.c 22 Feb 2004 08:56:43 -0000 1.139 -+++ options.c 20 Mar 2004 17:56:45 -0000 -@@ -119,6 +119,7 @@ char *log_format = NULL; +--- orig/options.c 2004-09-20 05:10:48 ++++ options.c 2004-07-03 20:13:41 +@@ -126,6 +126,7 @@ char *log_format = NULL; char *password_file = NULL; char *rsync_path = RSYNC_PATH; char *backup_dir = NULL; @@ -237,16 +235,16 @@ char backup_dir_buf[MAXPATHLEN]; int rsync_port = RSYNC_PORT; int link_dest = 0; -@@ -132,6 +133,8 @@ int list_only = 0; - #define MAX_BATCH_PREFIX_LEN 256 /* Must be less than MAXPATHLEN-13 */ - char *batch_prefix = NULL; +@@ -138,6 +139,8 @@ int list_only = 0; + #define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */ + char *batch_name = NULL; +struct chmod_mode_struct *chmod_modes = NULL; + static int daemon_opt; /* sets am_daemon after option error-reporting */ static int modify_window_set; -@@ -239,6 +242,7 @@ void usage(enum logcode F) +@@ -253,6 +256,7 @@ void usage(enum logcode F) rprintf(F," -g, --group preserve group\n"); rprintf(F," -D, --devices preserve devices (root only)\n"); rprintf(F," -t, --times preserve times\n"); @@ -254,7 +252,7 @@ rprintf(F," -S, --sparse handle sparse files efficiently\n"); rprintf(F," -n, --dry-run show what would have been transferred\n"); rprintf(F," -W, --whole-file copy whole files, no incremental checks\n"); -@@ -342,6 +346,7 @@ static struct poptOption long_options[] +@@ -360,6 +364,7 @@ static struct poptOption long_options[] {"perms", 'p', POPT_ARG_NONE, &preserve_perms, 0, 0, 0 }, {"owner", 'o', POPT_ARG_NONE, &preserve_uid, 0, 0, 0 }, {"group", 'g', POPT_ARG_NONE, &preserve_gid, 0, 0, 0 }, @@ -262,8 +260,8 @@ {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 }, {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 }, {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 }, -@@ -687,6 +692,13 @@ int parse_arguments(int *argc, const cha - exit_cleanup(RERR_SYNTAX); +@@ -804,6 +809,13 @@ int parse_arguments(int *argc, const cha + return 0; } + if (chmod_mode && !(chmod_modes = parse_chmod(chmod_mode))) { @@ -276,33 +274,21 @@ if (do_progress && !verbose) verbose = 1; -@@ -932,6 +944,11 @@ void server_options(char **args,int *arg - */ - args[ac++] = link_dest ? "--link-dest" : "--compare-dest"; +@@ -1083,6 +1095,11 @@ void server_options(char **args,int *arg args[ac++] = compare_dest; -+ } -+ + } + + if (chmod_mode && !am_sender) { + args[ac++] = "--chmod"; + args[ac++] = chmod_mode; - } - ++ } ++ if (files_from && (!am_sender || remote_filesfrom_file)) { ---- proto.h 17 Feb 2004 23:13:06 -0000 1.184 -+++ proto.h 20 Mar 2004 17:56:45 -0000 -@@ -25,6 +25,9 @@ void file_checksum(char *fname,char *sum - void sum_init(void); - void sum_update(char *p, int len); - void sum_end(char *sum); -+struct chmod_mode_struct *parse_chmod(char *modestr); -+int tweak_mode(int mode, struct chmod_mode_struct *chmod_modes); -+int free_chmod_mode(struct chmod_mode_struct *chmod_modes); - void close_all(void); - void _exit_cleanup(int code, const char *file, int line); - void cleanup_disable(void); ---- rsync.1 2 Feb 2004 18:23:09 -0000 1.163 -+++ rsync.1 20 Mar 2004 18:12:57 -0000 -@@ -336,6 +336,7 @@ to the detailed description below for a + if (remote_filesfrom_file) { + args[ac++] = "--files-from"; +--- orig/rsync.yo 2004-09-20 05:10:48 ++++ rsync.yo 2004-07-03 20:13:41 +@@ -330,6 +330,7 @@ verb( -g, --group preserve group -D, --devices preserve devices (root only) -t, --times preserve times @@ -310,39 +296,10 @@ -S, --sparse handle sparse files efficiently -n, --dry-run show what would have been transferred -W, --whole-file copy whole files, no incremental checks -@@ -614,6 +615,17 @@ modified cannot be effective; in other w - cause the next transfer to behave as if it used -I, and all files will have - their checksums compared and show up in log messages even if they haven\&'t - changed\&. -+.IP -+.IP "\fB--chmod\fP" -+This options tells rsync to apply the listed "chmod" pattern -+to the permission of the files on the destination\&. In addition to the normal -+parsing rules specified in the chmod manpage, you can specify an item that -+should only apply to a directory by prefixing it with a \&'D\&', or specify an -+item that should only apply to a file by prefixing it with a \&'F\&'\&. For example: -+.IP -+.RS -+--chmod=Dg+s,ug+w,Fo-w,+X -+.RE - .IP - .IP "\fB-n, --dry-run\fP" - This tells rsync to not do any file transfers, ---- rsync.yo 2 Feb 2004 18:23:09 -0000 1.147 -+++ rsync.yo 20 Mar 2004 18:12:58 -0000 -@@ -299,6 +299,7 @@ verb( - -g, --group preserve group - -D, --devices preserve devices (root only) - -t, --times preserve times -+ --chmod=CHMOD change destination permissions - -S, --sparse handle sparse files efficiently - -n, --dry-run show what would have been transferred - -W, --whole-file copy whole files, no incremental checks -@@ -534,6 +535,14 @@ modified cannot be effective; in other w - cause the next transfer to behave as if it used -I, and all files will have - their checksums compared and show up in log messages even if they haven't - changed. -+ +@@ -603,6 +604,14 @@ cause the next transfer to behave as if + updated (though the rsync algorithm will make the update fairly efficient + if the files haven't actually changed, you're much better off using -t). + +dit(bf(--chmod)) This options tells rsync to apply the listed "chmod" pattern +to the permission of the files on the destination. In addition to the normal +parsing rules specified in the chmod manpage, you can specify an item that @@ -350,12 +307,13 @@ +item that should only apply to a file by prefixing it with a 'F'. For example: + +quote(--chmod=Dg+s,ug+w,Fo-w,+X) - ++ dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers, instead it will just report the actions it would have taken. ---- testsuite/chmod.test 2004-02-13 17:08:33.000000000 -0800 -+++ testsuite/chmod.test 2004-03-20 08:58:14.000000000 -0800 -@@ -0,0 +1,37 @@ + +--- orig/testsuite/chmod-option.test 2004-06-18 17:22:09 ++++ testsuite/chmod-option.test 2004-06-18 17:22:09 +@@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 2002 by Martin Pool @@ -378,18 +336,24 @@ +mkdir "$fromdir" +name1="$fromdir/name1" +name2="$fromdir/name2" ++dir1="$fromdir/dir1" ++dir2="$fromdir/dir2" +echo "This is the file" > "$name1" +echo "This is the other file" > "$name2" ++mkdir "$dir1" "$dir2" + -+chmod 4700 "$name1" || test_skipped "Can't chown" ++chmod 4700 "$name1" || test_skipped "Can't chmod" ++chmod 700 "$dir1" ++chmod 770 "$dir2" + +# Copy the files we've created over to another directory +checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir" + +# And then manually make the changes which should occur -+chmod ug-s,a+rX $checkdir/* ++chmod ug-s,a+rX "$checkdir"/* ++chmod g+w "$checkdir" "$checkdir"/dir* + -+checkit "$RSYNC -avv --chmod ug-s,a+rX \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir" ++checkit "$RSYNC -avv --chmod ug-s,a+rX,Dg+w \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir" + +# The script would have aborted on error, so getting here means we've won. +exit 0