--- Begin Message ---
Package: rsync
Version: 2.5.5-0.2
Severity: wishlist
Hi,
please apply the following patch and feed it upstream. This will add
support for --target-gid=GID on both, the client and the server. This
option is especially useful when the gid on the target system has to
be way different than the one on the local host, but unfortunately the
group on the local host also exists on the target host.
Basically, it fixes this mess:
Local host:
User: joey
Group: users
Other groups: adm, man-de etc.
Quota: none
Files owned by joey.users
Remote host:
User: joey
Group: users
Other groups: site6
Quota: group site6: 30MB
group users: 10MB
Files will otherwise be owned by joey.users, resulting in a quota
problem. Unfortunately, *all* users are put into the users group.
This results in some files not being able to be rsync'ed due to a
filled up quota. Yes, that's broken by design, but please complain
at Cobalt... I'm only trying to use it...
Using --target-gid=site6 on the local host and having a fixed rsync
on the target host ($HOME/bin is sufficient), the problem doesn't
exist anymore.
In case some users already are in need of such a patch, please find
prepared packages here:
http://www.infodrom.org/Infodrom/patches/rsync/rsync_2.5.5-0.3.diff.gz
http://www.infodrom.org/Infodrom/patches/rsync/rsync_2.5.5-0.3.dsc
http://www.infodrom.org/Infodrom/patches/rsync/rsync_2.5.5-0.3_i386.changes
http://www.infodrom.org/Infodrom/patches/rsync/rsync_2.5.5-0.3_i386.deb
http://www.infodrom.org/Infodrom/patches/rsync/rsync_2.5.5.orig.tar.gz
Regards,
Joey
diff -u -Nur --exclude CVS orig/rsync-2.5.5/debian/changelog
rsync-2.5.5/debian/changelog
--- orig/rsync-2.5.5/debian/changelog Thu Jul 4 02:00:00 2002
+++ rsync-2.5.5/debian/changelog Fri Jul 5 01:24:23 2002
@@ -1,3 +1,11 @@
+rsync (2.5.5-0.3) unstable; urgency=low
+
+ * Non-maintainer Release
+ * Added support for --target-gid=GID. This is useful when the gid on
+ the target system is way different than the one on the local host.
+
+ -- Martin Schulze <[email protected]> Fri, 5 Jul 2002 01:24:17 +0200
+
rsync (2.5.5-0.2) unstable; urgency=medium
* NMU
diff -u -Nur --exclude CVS orig/rsync-2.5.5/options.c rsync-2.5.5/options.c
--- orig/rsync-2.5.5/options.c Tue Mar 19 21:16:42 2002
+++ rsync-2.5.5/options.c Fri Jul 5 01:19:37 2002
@@ -87,6 +87,7 @@
int modify_window=0;
#endif
int blocking_io=-1;
+int target_gid=0;
/** Network address family. **/
#ifdef INET6
@@ -112,6 +113,7 @@
char *password_file = NULL;
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
+char *target_group = NULL;
int rsync_port = RSYNC_PORT;
int verbose = 0;
@@ -239,6 +241,7 @@
rprintf(F," --partial keep partially transferred files\n");
rprintf(F," --force force deletion of directories even
if not empty\n");
rprintf(F," --numeric-ids don't map uid/gid values by
user/group name\n");
+ rprintf(F," --target-gid=GID use this as gid on the target
host\n");
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");
@@ -285,7 +288,7 @@
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_TARGET_GID,
OPT_NO_BLOCKING_IO, OPT_WHOLE_FILE, OPT_NO_WHOLE_FILE,
OPT_MODIFY_WINDOW, OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_IGNORE_EXISTING};
@@ -338,6 +341,7 @@
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd , 0, 0, 0 },
{"block-size", 'B', POPT_ARG_INT, &block_size , 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete , 0, 0, 0 },
+ {"target-gid", 0, POPT_ARG_STRING, &target_group , 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout , 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir , 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, &compare_dest , 0, 0, 0 },
@@ -436,6 +440,7 @@
int opt;
char *ref = lp_refuse_options(module_id);
poptContext pc;
+ struct group* grent;
/* TODO: Call poptReadDefaultConfig; handle errors. */
@@ -575,6 +580,10 @@
}
}
+ if (am_server && target_group)
+ if ((grent = getgrnam (target_group)) != NULL)
+ target_gid = grent->gr_gid;
+
if (write_batch && read_batch) {
snprintf(err_buf,sizeof(err_buf),
"write-batch and read-batch can not be used together\n");
@@ -609,6 +618,7 @@
static char argstr[50];
static char bsize[30];
static char iotime[30];
+ static char tgid[30];
static char mdelete[30];
static char mwindow[30];
static char bw[50];
@@ -709,6 +719,11 @@
snprintf(fext,sizeof(fext),fmt,batch_prefix);
args[ac++] = fext;
}
+
+ if (target_group) {
+ snprintf(tgid,sizeof(tgid),"--target-gid=%s",target_group);
+ args[ac++] = tgid;
+ }
if (io_timeout) {
snprintf(iotime,sizeof(iotime),"--timeout=%d",io_timeout);
diff -u -Nur --exclude CVS orig/rsync-2.5.5/rsync.c rsync-2.5.5/rsync.c
--- orig/rsync-2.5.5/rsync.c Thu Dec 20 16:33:13 2001
+++ rsync-2.5.5/rsync.c Fri Jul 5 01:20:49 2002
@@ -30,6 +30,8 @@
extern int preserve_gid;
extern int preserve_perms;
extern int make_backups;
+extern int target_group;
+extern int target_gid;
/*
@@ -174,6 +176,9 @@
updated = 1;
}
}
+
+ if (target_group && target_gid)
+ file->gid = target_gid;
change_uid = am_root && preserve_uid && st->st_uid != file->uid;
change_gid = preserve_gid && file->gid != (gid_t) -1 && \
--
A mathematician is a machine for converting coffee into theorems.
Please always Cc to me when replying to me on the lists.
--- End Message ---